Solved

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

Posted on 2004-09-30
2
652 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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

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…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 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