Click here to Skip to main content
15,903,012 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: CryptoAPI Pin
Mazdak20-Feb-04 0:50
Mazdak20-Feb-04 0:50 
GeneralStrong Namad Assemblies / Versioning Pin
Member 61613918-Feb-04 23:40
Member 61613918-Feb-04 23:40 
GeneralSending mail using default mail client in VB Pin
KiranGrover18-Feb-04 20:30
KiranGrover18-Feb-04 20:30 
GeneralRe: Sending mail using default mail client in VB Pin
John Kuhn18-Feb-04 20:40
John Kuhn18-Feb-04 20:40 
GeneralMap network drives--Plzz replyy Pin
radhika8118-Feb-04 18:20
radhika8118-Feb-04 18:20 
GeneralRe: Map network drives--Plzz replyy Pin
Pugman81218-Feb-04 19:09
Pugman81218-Feb-04 19:09 
GeneralRandom numbers and letters Pin
aahmad7618-Feb-04 16:33
aahmad7618-Feb-04 16:33 
GeneralRe: Random numbers and letters Pin
Nadroj18-Feb-04 18:24
Nadroj18-Feb-04 18:24 
i will give you an example of how to generate a random number. then, an example of how to return a character, using its Ascii value (ex, A = 65). then finally a way to return a random character.

** NOTE: for these examples, i am using a VB.net Console Application. **

GENERATE RANDOM NUMBER:
Module Module1
Sub Main()
'declare variable to store your random number
Dim myNumber As Integer

'initialize a method to generate random numbers
Randomize()

'create a random number and store it in our variable
myNumber = (50 * Rnd()) + 1
'the statement (50 * Rnd()) + 1) will generate a random number from 1-50.
'If you excluded the " + 1" part, it would generate a number from 0-49.

'write our variable to the screen
Console.WriteLine(myNumber)

'pause for display, by waiting untill the user presses -ENTER-
Console.ReadLine()
End Sub
End Module

RETURN A CHARACTER USING ASCII VALUES:
console.writeline(Chr(65))
'displays "A" on the screen. if you dont want to print it and only return its value, just use Chr(65).

GENERATE RANDOM CHARACTERS:
after reviewing the top 2 methods, you should be able to know how to do this. here is an example though:
Console.WriteLine(Chr((127 * Rnd()) + 1))
'this will display a random Ascii character. again, if you just want to return it and not print it, just use the Chr(...).

ASCII: for more info about Ascii and a chart of characters and their corresponding ASCII values, visit asciitable.com[^]. The "Dec" column is the "Chr"'s ASCII value.

------------------------
Jordan.
III
GeneralRe: Random numbers and letters Pin
aahmad7619-Feb-04 10:57
aahmad7619-Feb-04 10:57 
GeneralRe: Random numbers and letters Pin
Nadroj19-Feb-04 13:37
Nadroj19-Feb-04 13:37 
GeneralVB.NET read XSD from embedded resource Pin
mpalmer7818-Feb-04 9:40
mpalmer7818-Feb-04 9:40 
GeneralRe: VB.NET read XSD from embedded resource Pin
Mike Ellison19-Feb-04 6:21
Mike Ellison19-Feb-04 6:21 
GeneralPassing data from datagrid to Dataset Pin
Danny van der Walt18-Feb-04 9:17
Danny van der Walt18-Feb-04 9:17 
GeneralRe: Passing data from datagrid to Dataset Pin
John Kuhn18-Feb-04 20:23
John Kuhn18-Feb-04 20:23 
GeneralRe: Passing data from datagrid to Dataset Pin
Danny van der Walt19-Feb-04 19:55
Danny van der Walt19-Feb-04 19:55 
GeneralRe: Passing data from datagrid to Dataset Pin
John Kuhn22-Feb-04 8:07
John Kuhn22-Feb-04 8:07 
GeneralRe: Passing data from datagrid to Dataset Pin
Danny van der Walt22-Feb-04 23:57
Danny van der Walt22-Feb-04 23:57 
GeneralRe: Passing data from datagrid to Dataset Pin
John Kuhn23-Feb-04 13:49
John Kuhn23-Feb-04 13:49 
GeneralExcel in VB6 Pin
Wilbur J. Pereira18-Feb-04 7:41
Wilbur J. Pereira18-Feb-04 7:41 
GeneralRe: Excel in VB6 Pin
John Kuhn20-Feb-04 9:54
John Kuhn20-Feb-04 9:54 
GeneralRe: Excel in VB6 Pin
John Kuhn23-Feb-04 16:36
John Kuhn23-Feb-04 16:36 
GeneralArray display Pin
Isaiah2518-Feb-04 4:26
Isaiah2518-Feb-04 4:26 
GeneralRe: Array display Pin
Yogendra Agarwal19-Feb-04 9:12
Yogendra Agarwal19-Feb-04 9:12 
Generalnull delimited string Pin
r i s h a b h s17-Feb-04 23:47
r i s h a b h s17-Feb-04 23:47 
GeneralRe: null delimited string Pin
steff kamush18-Feb-04 5:35
steff kamush18-Feb-04 5:35 

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.