Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Attempting VB 2008

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Micah
Grandmaster Cheater
Reputation: 1

Joined: 30 Mar 2007
Posts: 833

PostPosted: Sat Feb 07, 2009 1:20 pm    Post subject: Attempting VB 2008 Reply with quote

I have been playing around with VB 2008 lately, trying to make an application for my dad.
I am not really familiar with it at all.

The application I am trying to make is supposed to generate a number using 5 different groups of numbers.
EG
The first number chosen would be 25, the second would be 14, the third would be 7, the fourth would be 55, and the 5th would be 34.
So the program would output 251475534

Here is what I have so far.

Code:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim LoopNumbr As Integer
        Dim Rnd As New Random
        Dim RAN As Integer
        Dim LotteryCol1(7) As String
        LotteryCol1(0) = "7"
        LotteryCol1(1) = "9"
        LotteryCol1(2) = "12"
        LotteryCol1(3) = "17"
        LotteryCol1(4) = "20"
        LotteryCol1(5) = "23"
        LotteryCol1(6) = "24"
        LotteryCol1(7) = "25"
        LoopNumbr = LoopNum.Text
        If LoopNumbr = 0 Then LoopNumbr = 1
        Do While LoopNumbr > 0
            RAN = Rnd.Next(LotteryCol1(0), LotteryCol1(7))
            ListBox1.Items.Add(RAN.ToString)
            LoopNumbr = LoopNumbr - 1
        Loop


This should display randomly, a number from the list of numbers, but unfotunately, that doesnt happen. What it does is it displace a number between 7 and 25.
Is it possible for it to choose only those numbers, and not in between?

Thanks for reading.
Back to top
View user's profile Send private message MSN Messenger
XTrinityX
Expert Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 123
Location: Connecticut

PostPosted: Sat Feb 07, 2009 3:44 pm    Post subject: Reply with quote

You want to generate a random index of your array of integers and use that index to retrieve your value.
Code:

            RAN = Rnd.Next(0, 8) //Generate number between 0 and 7, inclusive.
            ListBox1.Items.Add(LotteryColl(RAN))
Back to top
View user's profile Send private message AIM Address
Micah
Grandmaster Cheater
Reputation: 1

Joined: 30 Mar 2007
Posts: 833

PostPosted: Sat Feb 07, 2009 6:07 pm    Post subject: Reply with quote

Thanks! I had something like that, but it was different, so it didn't work!
+Rep once I try this.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites