Click here to Skip to main content
16,014,869 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: adding autonumber to VB form - beginner question Pin
Dave Kreskowiak7-May-04 17:46
mveDave Kreskowiak7-May-04 17:46 
GeneralRe: adding autonumber to VB form - beginner question Pin
pawn_me8-May-04 19:51
pawn_me8-May-04 19:51 
GeneralRe: adding autonumber to VB form - beginner question Pin
Dave Kreskowiak9-May-04 3:57
mveDave Kreskowiak9-May-04 3:57 
GeneralAccessing a database on a network drive Pin
ccotton3337-May-04 6:38
ccotton3337-May-04 6:38 
GeneralRe: Accessing a database on a network drive Pin
Dave Kreskowiak7-May-04 9:52
mveDave Kreskowiak7-May-04 9:52 
GeneralRandom Number Generator Pin
Britnt77-May-04 3:31
Britnt77-May-04 3:31 
GeneralRe: Random Number Generator Pin
Colin Angus Mackay7-May-04 3:59
Colin Angus Mackay7-May-04 3:59 
GeneralRe: Random Number Generator Pin
Britnt77-May-04 4:51
Britnt77-May-04 4:51 
Yes Smile | :) with a few added lines which are in bold:

Dim Array(4) As Integer<br />
Dim Counter As Integer<br />
Dim CheckCounter As Integer<br />
Dim Current As Integer<br />
Dim isOkay As Boolean<br />
For Counter = 0 To 4<br />
    isOkay = True<br />
    Do<br />
        Current = CInt(Int(49 * Rnd()) + 1)<br />
        For CheckCounter = 0 To Counter - 1<br />
            If Current = Array(CheckCounter) Then<br />
                isOkay = False<br />
                Exit For<br />
            Else<br />
                isOkay = True<br />
            End If<br />
        Next<br />
    Loop While isOkay = False<br />
    Array(Counter) = Current<br />
Next<br />
Array.Sort(Array)<br />
lbl1.Text = Array(0)<br />
lbl2.Text = Array(1)<br />
lbl3.Text = Array(2)<br />
lbl4.Text = Array(3)<br />
lbl5.Text = Array(4)


I had to add the else isOkay = true because with your origional code, once isOkay was set to false it was stuck in the loop. Which has solved my problem.
Thanks againBig Grin | :-D

Beginner in VB.NET
GeneralRe: Random Number Generator Pin
Colin Angus Mackay7-May-04 5:02
Colin Angus Mackay7-May-04 5:02 
GeneralRe: Random Number Generator Pin
Britnt77-May-04 5:29
Britnt77-May-04 5:29 
GeneralRe: Random Number Generator Pin
Colin Angus Mackay7-May-04 12:08
Colin Angus Mackay7-May-04 12:08 
GeneralRe: Random Number Generator Pin
Britnt712-May-04 2:29
Britnt712-May-04 2:29 
GeneralRe: Random Number Generator Pin
Nick Seng12-May-04 0:02
Nick Seng12-May-04 0:02 
GeneralRe: Random Number Generator Pin
Britnt712-May-04 2:38
Britnt712-May-04 2:38 
GeneralRe: Random Number Generator Pin
Britnt712-May-04 3:23
Britnt712-May-04 3:23 
GeneralVB.NET Forms and Painting Pin
opopov6-May-04 22:08
opopov6-May-04 22:08 
GeneralRe: VB.NET Forms and Painting Pin
Syed Abdul Khader7-May-04 0:45
Syed Abdul Khader7-May-04 0:45 
GeneralRe: VB.NET Forms and Painting Pin
opopov7-May-04 5:29
opopov7-May-04 5:29 
GeneralRe: VB.NET Forms and Painting Pin
Syed Abdul Khader10-May-04 21:11
Syed Abdul Khader10-May-04 21:11 
Generalslideshow app in vb6 Pin
Ashwin C6-May-04 9:07
Ashwin C6-May-04 9:07 
GeneralRe: slideshow app in vb6 Pin
Dave Kreskowiak7-May-04 10:06
mveDave Kreskowiak7-May-04 10:06 
GeneralCom based add-in office Pin
skoizumi291106-May-04 6:01
sussskoizumi291106-May-04 6:01 
GeneralFrom C# to VB.Net Pin
Clandestine6-May-04 5:32
Clandestine6-May-04 5:32 
GeneralRe: From C# to VB.Net Pin
Dave Kreskowiak6-May-04 6:18
mveDave Kreskowiak6-May-04 6:18 
GeneralRe: From C# to VB.Net Pin
Clandestine7-May-04 3:30
Clandestine7-May-04 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.