I'm trying to make a program to print bingo cards. I have the card images made without numbers on them. I'm looking for a good way to print the cards with the numbers on them. How can I do that?
Printable View
I'm trying to make a program to print bingo cards. I have the card images made without numbers on them. I'm looking for a good way to print the cards with the numbers on them. How can I do that?
:wave:
If youd like to randomly generate the numbers here is a simple sample using a commandbutton1 and a label label1
VB Code:
Private Sub Command1_Click() label1.caption = Int(Rnd * 50)'may change to set the max number to generate 'also can add label2,label3,label4,ect..... End Sub
now you could place several labels in a picbox that has your image in it
and set the textboxes to transparent backround
(to blend in with your image) you could add diff font and sizes to the labels caption and then you could randomly generate the numbers and then print the picbox with
picture1.print
Is this generaly what your after?
also this would be about as basic as it gets if youd like it to print full pages of the cards that would be a diff story :D
_________________________________________________________________
Please rate if I have been helpful :thumb:
You can print the numbers on the picturebox, then you don't have to create the textboxes.
VB Code:
Private Sub Command1_Click() 'Print numbers on Picture Dim iRow As Integer Dim iCol As Integer Dim number As Integer Picture1.FontSize = 14 Picture1.FontBold = True Picture1.AutoRedraw = True For iRow = 0 To 5 For iCol = 1 To 10 number = (iRow * 10) + iCol Picture1.CurrentY = iRow * 400 Picture1.CurrentX = iCol * 500 - TextWidth(number) * 2 Picture1.Print number Next iCol Next iRow End Sub Private Sub Command2_Click() 'Send image to printer Printer.PaintPicture Picture1.Image, 100, 100 Printer.EndDoc End Sub
:blush: yeah I went to fast as well I should have been using labels with transparent set :blush:
I edited the original post
Nice way to do it as well guyvdn :afrog:
Thanks, that information & code helps. I got 1 last question related to this. How do I get the cards to print at a certain size? I want the cards to be 4 inches by 4 inches printed.
Set the scale mode of the printer to Inch and add extra parameters to the PaintPicture function.
VB Code:
Printer.ScaleMode = 5 'Inch Printer.PaintPicture Picture, Xpos, Ypos, Width, Height
I've got the cards made now and displayed on the form. I've got 4 cards made to print per page. My problem is getting the cards to print now. How can I print the 4 cards? I've use the code Guyvdn mention to make the cards.
you can put the code into a loop and use the same code (guyvdn) to print the cards
I also provided the code to get the picture printed
Quote:
Originally Posted by guyvdn
Wouldn't that only send 1 card to the printer at a time? How do you do it for 4-6 cards to print on a piece of paper at a time?
Like this
VB Code:
Printer.PaintPicture Picture1.Image, 100, 100 Printer.NewPage Printer.PaintPicture Picture2.Image, 100, 100 Printer.NewPage Printer.PaintPicture Picture3.Image, 100, 100 Printer.NewPage Printer.PaintPicture Picture4.Image, 100, 100 Printer.EndDoc
If you want 4 cards on one page you have to play with the x1, y1 parameters to set the postions
VB Code:
Printer.PaintPicture Picture1.Image, 100, 100 Printer.PaintPicture Picture2.Image, 300, 100 Printer.PaintPicture Picture3.Image, 100, 300 Printer.PaintPicture Picture4.Image, 300, 300 Printer.EndDoc
Thank you. I'll try that.