Vb

Discussion in 'Mac Programming' started by MacHappytjg, May 22, 2008.

  1. MacHappytjg macrumors 65816

    Joined:
    Mar 24, 2008
    Location:
    Winnipeg
    #1
    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
     
  2. aross99 macrumors 68000

    aross99

    Joined:
    Dec 17, 2006
    Location:
    East Lansing, MI
    #2
    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...
     
  3. MacHappytjg thread starter macrumors 65816

    Joined:
    Mar 24, 2008
    Location:
    Winnipeg
    #3
    ahh icci
    so should i make a new thread
    ???
     
  4. aross99 macrumors 68000

    aross99

    Joined:
    Dec 17, 2006
    Location:
    East Lansing, MI
  5. MacHappytjg thread starter macrumors 65816

    Joined:
    Mar 24, 2008
    Location:
    Winnipeg
    #5
    Randomizing pictures

    How do i randomize images in visual basic 6.0????
     
  6. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #6
    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
     
  7. spatlese44 macrumors 6502

    Joined:
    Dec 13, 2007
    Location:
    Milwaukee
    #7
    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
     
  8. tacoman667 macrumors regular

    Joined:
    Mar 27, 2008
    #8
    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.
     

Share This Page