iam having a hard time with the printing code

dennis_ian

New member
Joined
Dec 8, 2011
Messages
4
Programming Experience
Beginner
Hi good morning.(=

I just recently learned vb and with the help of reading different tutorials, i was able to create my first vb db which i would like to use at our office. Its a counter transaction ticketing system. Finding my way through the different code, i was able to came up with these one.

Public Class Form1
Dim iTicket As Integer


Function getTicket()
iTicket = iTicket + 1
getTicket = iTicket
End Function



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

buttonOnClick()
MsgBox("Please proceed at Counter 17.Your ticket is number " & getTicket())
MsgBox("Print your number?")

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

iTicket = 0
End Sub



Private Sub buttonOnClick()

End Sub


But the thing is, even if i google the steps on how to print and even ask other friend how to do it, iam having a hard time making code for printing. Would it be to much if i ask you friends to give me an idea or a sample what code should i put for me to able to finish this project? Ive been with this printing thing for almost a month now and i really wanna finish this project. untitled.JPGThank you so much in advance.
 
thank you sir. i happened to stumble upon this one. But the problem is, its giving me samples that i couldnt understand. To tell u the truth, the short and simple code that i made took me months just to make it work. I really dont have a background in vb. Iam just teaching myself through reading. I am hoping some one could help me with a simple code with the sample i gave then i could take it from there. Anyway thank u very much. (=
 
You need to focus on the PrintPage event. You'll only be printing a single page so there's no need to worry about what page is printing. You probably don't need to worry about any calculations either. You should just be able to call DrawString a few times. That tutorial covers PrintPage and DrawString.
 
Actually i need to print another page which say something like this jmcilhinney:

Please proceed to Counter _____ (it could be 17, 18, or 19)
You are number _____

am working on a ticketing system. will i see it to in the printpage event jmcilhinney?? Could the second be printed instead of the main form? (=
 
There's no "instead of". You print whatever you want. You call Print on a PrintDocument, handle the PrintPage event and then use GDI+ to draw whatever it is that you want printed. That might be a pixel for pixel representation of what's on screen or it might have no relation to what's on screen at all. You print whatever it is that you want to print.
 
Back
Top