Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacHappytjg

macrumors 65816
Original poster
Mar 24, 2008
1,498
1
Winnipeg
do people answer questions about visual basic on here cause well i suck at it and need to finish a school project. (simple Matching game) yes it sounds pathetic but im in grade 10
 

aross99

macrumors 68000
Dec 17, 2006
1,541
1
East Lansing, MI
You won't know until you ask. Many of us have a variety of programming experience, and often the questions you have may be able to be answered even if we aren't VB experts...

So, ask away...
 

MacHappytjg

macrumors 65816
Original poster
Mar 24, 2008
1,498
1
Winnipeg
You won't know until you ask. Many of us have a variety of programming experience, and often the questions you have may be able to be answered even if we aren't VB experts...

So, ask away...

ahh icci
so should i make a new thread
???
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I don't know anything about VB, but I would make an array of image objects that is N long. Then get a random number(I'm sure there is a facility to do this in VB) and get that number modulo N. Use that result as the index to your image array. Voilà! Random image.

-Lee
 

spatlese44

macrumors 6502
Dec 13, 2007
468
115
Milwaukee
something like:

dim a(99) as pict

numbImages=88

i=int(rnd(1)*numbImages)

img.pict = a(i)

am sure getting these wrong as I know VB but haven't played with it in a bit...

actually, might have to create large enough array of actual objects and hide them and access those
 

tacoman667

macrumors regular
Mar 27, 2008
143
0
I actually started in Basic, VB6, VB.NET, and moved on to C#. I did C++ on the side and I love the syntax.

Read up on the rnd() function. I believe you would need to create a seed first just like in any other language. It's been too stinking long since I did VB. I moved out of the VB language and never looked back. If memory serves, you can also "redim" an array but you need to read up on that as well considering if you redim'd to a smaller size you lose the difference at the end and keep the otehr values. If you redim larger then you keep all values with nothing assigned to the difference at the end.

I would like to make one last suggestion. Get out of VB6 as fast as possible. If your heart is set on VB being your first language, I highly suggest downloading the free Visual Basic Express 3008 from Microsoft's website and learn .NET. It makes life so much easier and you will go so much farther in it as .NET is being expanded every day. VB6 has not been supported by Microsoft for over 5 years.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.