Print() Method in VB.NET

Hi. Is there any way to make the equivalent of the print() method in VB.NET VB 6 has a print() method, which, from what I can tell puts out text to the form without any labels or whatever needed.
1. Is my assumption correct
2. If it is, can it be done in VB.NET also
3. If it can, HOW

Thanks,
The Digital Pioneer


Answer this question

Print() Method in VB.NET

  • davisp2

    Hi,


    Well, Print method in VB is used to display text values in the immediate window. It is mainly used for debugging. Though IMHO, Debug.Print() is the more appropriate function to use when debugging...






    cheers,



    Paul June A. Domag



  • srinivas_234

    Hi,


    If you want to mimic the print function. You could try handling the Paint Event of the form:

    Public Sub PaintHandler(sender As Object, e As PaintEventArgs)Handles Form1.Paint

        Dim fnt As New Font("Arial",10,FontStyle.Bold,GraphicsUnit.Point)
        Dim fntBrush As New SolidBrush(Color.Black)

        e.Graphics.DrawString("My String",fnt,fntBrush,x,y)

        fntBrush.Dispose()
        fnt.Dispose()

    End Sub


    This is pretty much useful if you want to create transparent text in your form...
    If you want to use it just to debug. then Just like Kannan said, use msgbox or Debug.Print() method....




    cheers,


    Paul June A. Domag


  • Robert D Misiak

    So is there any way to write secure information to a file so that someone can't just open it with notepad or whatever and read it

  • Tom Arnold

    Then why does it always say the print() method has something to do with 'Print to File' What does Print to File mean anyway
  • MasonUSA

    Is that where it doesn't just make a text file, but a file that does not contain readable text
  • GeorgesZ

    OK. Thanks for your time and troulble.
    The Digital Pioneer

  • Mike Gledhill

    Hi,


    Well, it generally depends. If you open your file as binary, then you probably want to save binary streams of data, thus it's unreadable. Opening it as text assumes that your going to write readable data... But the method of OPEN/CLOSE file in VB 6 is an age old approach. Try searching for FileSystemObject in MSDN. Its a much more friendlier way of approach in File Handling in VB 6...




    cheers,


    Paul June A. Domag

  • Maytel

    Hi,



    Well, you could try encrypting your text and save it so that nobody could just read it...
    Or you could use the File.Encrypt Method...
    http://msdn2.microsoft.com/library/30sf3kce(en-us,vs.80).aspx






    cheers,



    Paul June A. Domag

  • RustyJCNC

    Hi,

    If you like to know only the value of the print.. just you can use messagebox.show method. Now vb.6 print is not available.

    kannan.

  • Eddie Hulme

    Hi,


    well, the print method that you are seeing there is the print method used to print display-formatted data to a sequential file. I can't remember it well, but i guess you would use it in conjuncture with the OPEN, CLOSE commands on opening files...




    cheers,



    Paul June A. Domag

  • Aurelien Couderc

    Option B failed me. More details on option A please.


    In other words, the File.Encrypt method didn't do much for me. No matter what I tried, it just gave me an 'Unhandled IOException'. You said I could try encrypting your text and save it so that nobody could just read it OR use the File.Encrypt Method. The File.Encrypt method didn't work. What did you mean by "...encrypting your text..."  Sounds like the same thing to me...


    This is what I have been using. Tell me if it's wrong...



    Dim password As New System.IO.StreamWriter("C:\pass.txt", False)
            password.WriteLine(InputBox("What should the new password be "))
            password.Close()
            File.Encrypt("C:\pass.txt")class
    ="txt4">

     

    And what on earth does that 'class="txt4">' thing mean

  • blackspider

    I see. I never did understand exactly what the point of the print() method was in VB.NET. What exactly does it do

  • Print() Method in VB.NET