By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 2,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

Random number generation

P: 44
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.EventArgs) 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(str)
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(str)
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.ExecuteNonQuery()
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"(with different fonts and different colors)

Like the one which is in Yahoo Sign Up page

-suganya
Mar 17 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.