Random number generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweatha
    New Member
    • Mar 2008
    • 44

    Random number generation

    Hi Friends

    I have designed a form with a label box named 'Label30' and text box named 'TextBox21'. Then I have generated the random number in the label box using the coding in form load event as

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    'Put user code to initialize the page here
    str = "user id=sa;password= ;data source=AURO-RA4;initial catalog=suganya ;server=AURO-RA4"
    con = New SqlConnection(s tr)
    Try
    con.Open()
    Catch
    End Try
    If Label1.Text <> "" Then
    str = "user id=sa;password= ;data source=AURO-RA4;initial catalog=suganya ;server=AURO-RA4"

    con = New SqlConnection(s tr)
    Try
    con.Open()
    Catch
    End Try
    Dim obj As New RandomService
    Dim value As Double

    If TextBox21.Text = Label30.Text Then

    str1 = "Insert into matching values(" & TextBox21.Text & ")"
    cmd = New SqlCommand(str1 , con)
    cmd.ExecuteNonQ uery()
    con.Close()
    Response.Write( "Inserted")
    End If
    End If

    Dim Random1 As New Random
    Label30.Text = Random1.Next

    End Sub

    Now the thing is, I need a code to generate the random number with some characters. For eg,
    "76SFr3y"(w ith different fonts and different colors)

    Like the one which is in Yahoo Sign Up page

    -suganya
Working...