hi iam new with vb and iam just trying to learn this one by reading tutorials online. After months of trying, i have created one db which i would like to use at our office. Its a counter Ticketing system. Its fun actually i must say, but its also giving me the headache with the trial and error am doing. Please, could someone help me. Attached is the print screen of my project.


I was able to make it work. Yes, it prints the number it needs to print. The problem is, instead of printing the next number, it only prints the number 1. here is the code that i used.

Public Class Form1
Dim iTicket As Integer
Dim ReturnString As String
Dim k As String = TestFunc2()

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

End Function

Private Function TestFunc2() As String

ReturnString = "Your number is " & getTicket()
Return ReturnString


End Function

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

iTicket = 0
End Sub
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?", MsgBoxStyle.YesNo)


If vbYes Then

PrintiTicket.Print()


ElseIf vbNo Then

Close()

End If


End Sub


Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintiTicket.PrintPage

e.Graphics.DrawString(ReturnString, TextBox1.Font, Brushes.Blue, 100, 100)

End Sub


Private Sub buttonOnClick()

End Sub

Please i really need help. I just really need to finish this project before the season of enrolment starts. Pleasee...Thank you so much in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.