Page 1 of 1

RANDOM ID BASED ON YOUR NAME

Posted: Sat Nov 26, 2011 9:45 am
by Rookie
hi everyone here's some code that can help you also whenever you create a system or something like that! hehe

first add two textbox
  • the first one is the TxtID
  • and the second one is the txtname
just double click the second txtbox which is the txtname and paste the codes here.
Code: Select all
 Try
            If txtname.Text.Length >= 3 Then
                Dim num As String
                num = Format(CInt(Rnd() * 1000), "000")

                Dim letters As String = ""
                letters = txtTitle.Text.Substring(0, 3)

                Dim month As String
                month = Format(Today, "MMM").ToUpper

                Dim year As Integer
                year = Today.Year

                txtID.Text = num & letters & "-" & month & year

            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
THANKS TO YOU :)

Re: RANDOM ID BASED ON YOUR NAME

Posted: Wed Nov 30, 2011 2:46 am
by Rookie
i didn't copied this
i learned it through the tutorial of our school so i have decided to share it.