Jump to content
Maffegozer

VB Random Function/Event

Recommended Posts

Hello,

I've been working on a program for a few months.

But I need the program to choose a random event from a list. And add it to the Listbox.

But I can't figure out how to get it to choose a random one...

What I've figured out (the easy part):

'Here comes the random event part... Which i cant figure out...

Dim Incident as Integer

Select Case Incident
Case 0
ListBox1.Items.Add("My item 1")

Case 1
ListBox1.Items.Add("This is my second item!")

But I need about 30-50 events...

Can anyone reach me a hand?

Regards, Maffegozer.

-EDIT-

A friend of mine (Dion) told me to use this:

Public Function Rand(ByVal Low As Long, _
ByVal High As Long) As Long
Rand = Int((High - Low + 1) * Rnd) + Low
End Function

Figuring out now how to use the function in my Form_Load

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...