Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2011
    Posts
    45

    Unanswered: Am really having a hard time with the printing. )=

    Hi good morning.(=

    I just recently learned vb and with the help of rocslide, 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? Thank you so much in advance.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Well first off,... where you have

    MsgBox("Print your number?")

    You are going to need to use something else because this will not let you answer Yes or No, it just gives and Ok button.

    Google vbYesNo and it should help with this.

    Once this is done post your code here and I will give you your next pointer.

  3. #3
    Join Date
    Oct 2011
    Posts
    45
    rokslide, could you check this one?? i think i got it.

    Dim answer As MsgBoxResult


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

    If answer = MsgBoxResult.Yes Then

    PrintForm1.Print()
    End If

    End Sub

    i just got the printform1.print on google but iam just wondering, where should i design the form so i could get the print out on this format:

    Counter ___ (Counter number)
    Number ___( clients number on the que)

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    You are getting there, but what is setting the value of 'answer'??

  5. #5
    Join Date
    Oct 2011
    Posts
    45
    ahh, i just figure it will solve the problem. (see attached file), cause when i did put the value of 'answer' there, i think it worked. Did i get it? or do i have to rewrite it again?
    Attached Thumbnails Attached Thumbnails error.JPG  

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Your first answer was more correct.

    You have set up a variable called answer to hold the value from the message box but you are not actually assigning it the value from the message box. It is defaulting to some value when you set it up (this is where you have your Dim statement).

    Have a look at the example at the bottom of this page
    MsgBox Method

    Pay particular attention to how they are using/seting up their response variable.

  7. #7
    Join Date
    Oct 2011
    Posts
    45
    hi rocslide, i think i got it.

    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 = MsgBoxResult.Yes Then

    PrintForm1.Print()
    End If

    End Sub


    but its printing the whole form, while i just want it to print these texts,

    Counter ___ (Counter number)
    Number ___( clients number on the que)

Posting Permissions

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