CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011

    Really need some help with the printing

    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
        Function getTicket()
            iTicket = iTicket + 1
            getTicket = iTicket
        End Function
        Private Sub Routine()
            ReturnString = "Your number is " & getTicket().ToString
        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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            MsgBox("Please proceed at Counter 17.Your ticket is number " & getTicket())
            MsgBox("Print your number?", MsgBoxStyle.YesNo)
            If vbYes Then
            ElseIf vbNo Then
            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.
    Attached Images Attached Images  

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Really need some help with the printing

    You are printing returnstring but you are not setting it in your getticket() routine.

    You are setting it in your Routine() sub routine but you are not calling that routine.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.