473,385 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

bingo codes needed

1
hi, i have to play bingo in vb , but im really stuck....i just need very simple code to create random numbers in one label.....thanks for your help
Jun 12 '07 #1
1 3985
DJWim
8
Couldn't resist to quickly put somethig together, but I would assume there are much more sophisticated program around. At least you have a starting point here.
Add a command1, command2 button and a text1 field to your form, and paste the code below in yor program code and bingo! :-))

I would extend the program to show on screen all numbers drawn sofar, etc...

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.   Const MAX As Integer = 80'set max nr, change to whatever  the game requires
  3.   Dim iNrs(1 To MAX) As Boolean'assume first number = 1
  4.   Dim iCnt As Integer
  5.  
  6. Private Sub Command1_Click() 'clear, start fresh
  7.   Dim i As Integer
  8.   For i = 1 To MAX
  9.     iNrs(i) = False
  10.   Next i
  11.   iCnt = 0
  12. End Sub
  13.  
  14. Private Sub Command2_Click()'draw a number
  15.   Dim iNr As Integer
  16.   If iCnt < MAX Then
  17.     Do
  18.       iNr = Int((MAX * Rnd) + 1)'generate nr between 1 and MAX
  19.     Loop Until Not iNrs(iNr)
  20.     iCnt = iCnt + 1
  21.     iNrs(iNr) = True
  22.     Text1.Text = iNr
  23.   Else
  24.     Call MsgBox("All numbers done", vbInformation, "done")
  25.   End If
  26. End Sub
  27.  
  28. Private Sub Form_Load()
  29.   Randomize
  30. End Sub
  31.  
Jun 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

33
by: Geoff Berrow | last post by:
I may have mentioned that I run an Introduction to PHP course at a local college (very basic - I'm no PHP expert). Well, one of my students was doing really well so I set him some extension work. ...
8
by: Shane Groff | last post by:
I know this is a recurring discussion (I've spent the last 3 days reading through threads on the topic), but I feel compelled to start it up again. After reading through the existing threads, I...
4
by: Will Woodhull | last post by:
I want to do something like this: while(false == ($result = mysql_query($query)) ) { switch(mysql_errno()) { case $fixableError: case $fixableError: /* fix the errors */ break; default: die...
5
by: perryche | last post by:
Problem #1: I have a form, which says, has 2 fields: F1 & F2 (both Dates). I want to be able to change F1 and F2 will change to be the same as F1 in the codes. However, I will still be able...
6
by: ljungers | last post by:
I have a memo field that is printed using Access Reports. Various fields from this table are used to fill in the heading and the body of the report uses that memo field. I now need to place some...
3
bhing
by: bhing | last post by:
Hiya all!!! i would like to ask about the http logs i found in logs directory in tomcat. This is some of the codes i clipped: ----------------------------------------------------------- ...
9
by: Fsunka | last post by:
Hey, I have a project due around February 28. I have to create a program that asks the user for the number of players that want to play bingo. Then it creates that many bingo cards. Then it calls...
12
by: hollis092 | last post by:
I am writing code for the game of BINGO. The code below shows a function that fills the card with random numbers. A random number in each location, 0-15 for B column; 16-30 for I column, 31-45 for...
1
by: brandon | last post by:
I know this thread is old but I found a great website for inexpensive developer and marketing lists for zip codes. Plus they give free updates. http://www.listfactor.com They have lists for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.