Click here to Skip to main content
15,902,634 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralDataGrid Headers Grouped Pin
Lucko7-May-04 16:47
Lucko7-May-04 16:47 
Generaladding autonumber to VB form - beginner question Pin
pawn_me7-May-04 14:42
pawn_me7-May-04 14:42 
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 
I am trying to get 5 random numbers between the numbers of 1 to 50 using vb.net. This is what I came up with so far:

Dim Array(4) As Integer
Dim Counter As Integer

For Counter = 0 To 4
Array(Counter) = CInt(Int((49 * Rnd()) + 1))
Next
Array.Sort(Array)
lbl1.Text = Array(0)
lbl2.Text = Array(1)
lbl3.Text = Array(2)
lbl4.Text = Array(3)
lbl5.Text = Array(4)

This code actually works but the thing is that it can pick the same number twice. I need all 5 numbers to be different. How can I achieve this?
Please help and thanks in advance.Confused | :confused:

Beginner in VB.NET
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 
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 

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.