Solved

Generating A Random Char from A-Z and 0-9

Posted on 2004-09-30
2
650 Views
Last Modified: 2010-05-19
I would like to know how to generate a  random character consisting of the alphabet and numbers 0-9.

And then I would like to add 16 random characters to an array that I can use for a keycode.

        Dim strArray(15) As String
        Dim c As Char
        Dim i As Integer

        For i = 0 To 15
            strArray(i) = ""Random Char Generation Here.""
        Next
Can anyone give me a hand?
0
Comment
Question by:UberDeveloper
2 Comments
 
LVL 19

Accepted Solution

by:
Desp earned 125 total points
ID: 12197718
do you need sometihing like this:
Dim Rand As String = String.Empty
        Dim r As Random = New Random(DateTime.Now.Millisecond)

        Dim i As Int32

        For i = 0 To 15
            If r.Next(1, 3) = 2 Then

                Rand += (Microsoft.VisualBasic.ChrW(r.Next(48, 57)).ToString())
            Else

                Rand += (Microsoft.VisualBasic.ChrW(r.Next(65, 90)).ToString())
            End If
        Next

        MsgBox(Rand)
0
 
LVL 2

Author Comment

by:UberDeveloper
ID: 12197744
Yes, thank you its perfect.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.Net. Reading xml value 6 36
ASP.NET (VB) return a record 2 51
vb.net background worker crossthread 11 25
vb.net datagrid point 4 16
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question