If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Am really having a hard time with the printing. )=

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-11, 18:40
dennis_ian dennis_ian is offline
Registered User
 
Join Date: Oct 2011
Posts: 45
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.
Reply With Quote
  #2 (permalink)  
Old 12-04-11, 21:32
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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.
Reply With Quote
  #3 (permalink)  
Old 12-04-11, 21:52
dennis_ian dennis_ian is offline
Registered User
 
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)
Reply With Quote
  #4 (permalink)  
Old 12-04-11, 21:53
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
You are getting there, but what is setting the value of 'answer'??
Reply With Quote
  #5 (permalink)  
Old 12-04-11, 22:01
dennis_ian dennis_ian is offline
Registered User
 
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
Am really having a hard time with the printing. )=-error.jpg  
Reply With Quote
  #6 (permalink)  
Old 12-05-11, 12:26
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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.
Reply With Quote
  #7 (permalink)  
Old 12-08-11, 20:52
dennis_ian dennis_ian is offline
Registered User
 
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)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On