Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > Print method
 

Print method

Hello Everyone,

I'am Absolute beginner in learnning to Program with VisualBasic 8. The Question I have is How I can used the print method to print information on a form.
Not using the msgbot method. I'am trying this Exercise Project but I lost. I will give the step i try for the print method.

1. Create Project

2. Use me Toolbox to place a single Button on the form. Accept the default name that VB8 assigns.

3. I Double-click on the Button and place the following code into the click event procedure of the button .

(Display Screen)

Private

Sub Button1_Click

Form1.Print "Eat at Joe's"
Form1.Print "Eat at Tom's"
Form1.Print "Eat at Kevin's"
Form1.Print "Eat at Rich's"
End Sub

but it will not work. So what i am doing wrong.

Thanks

Starmuyo  Sunday, August 30, 2009 5:52 PM
Hi Starmuyo,

After I read your post, I don't think the following code is VB.NET code.
Sub Button1_Click
Form1.Print "Eat at Joe's"
Form1.Print "Eat at Tom's"
Form1.Print "Eat at Kevin's"
Form1.Print "Eat at Rich's"
End Sub

Do you want to print "Eat at Joe's", "Eat at Tom's", ... etc line by line? Here is the VB.NET code that implement this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As Graphics = Me.CreateGraphics()
g.DrawString("Eat at Joe's", Me.Font, Brushes.Black, 10, 10)
g.DrawString("Eat at Tom's", Me.Font, Brushes.Black, 10, 20)
g.DrawString("Eat at Kevin's", Me.Font, Brushes.Black, 10, 30)
g.DrawString("Eat at Rich's", Me.Font, Brushes.Black, 10, 40)

End Sub

If you have any problem with this, please feel free to tell me.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Tuesday, September 01, 2009 3:17 AM
We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post editor window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Friday, September 04, 2009 8:09 AM

You can use google to search for other answers

Custom Search

More Threads

• How to disable auto updater?
• Occupied Space and cellRadius
• Do you need "Microsoft Visual Studio .NET 2003"?
• Question on Public Function InsertUser()...
• Marker Interfaces? This is .NET with C# ! NOT JAVA!
• Unable to Install TV Server on Windows Server 2003 Std.
• Resizing?
• Problem with PhotoAdmin.asmx
• Image Modifications
• Curious about security architecture in TaskVision