## 2 replies

Last post Dec 03, 2010 03:24 AM by vengat.net

Member

13 Points

89 Posts

### exact 16 digit number

hi tutor's

Dim i As Integer

For i = 1 To 20If Mid(sstring, i, 1) Like "[0-9]" Then

identinumber = identinumber + Mid(sstring, i, 1)

End If

Next i

that code generate number like 12456456985236978412 its not stable some time show onle 16 digit some time 15 digit i want unique number and exact 16 digit please help ASAP

vengatesh

Dot net Developer

SGS Technologie

All-Star

28667 Points

7172 Posts

### Re: exact 16 digit number

Nov 24, 2010 12:48 AM|Rajneesh Verma|LINK

Working code:

```Dim fiveRandom As System.Random = New Random()
Dim tsFive As New TimeSpan()
tsFive = DateTime.Now.Subtract(Convert.ToDateTime("01/01/1900"))
Dim rad As String = fiveRandom.[Next](10000, 99999) + tsFive.Days.ToString() & System.DateTime.Now.Hour.ToString("00") & System.DateTime.Now.Minute.ToString("00") & System.DateTime.Now.Second.ToString("00")```

Member

13 Points

89 Posts

### Re: exact 16 digit number

```Public Function identinumber() As String
Dim sstring As String = System.Guid.NewGuid().ToString()
Dim i As Integer
For i = 1 To Len(sstring)
If Mid(sstring, i, 1) Like "[0-9]" Then
identinumber = identinumber + Mid(sstring, i, 1)
End If
Next i

If identinumber.Length > 16 Then
Return identinumber.Substring(0, 16)
Else
Return identinumber.Concat(identinumber, "00000000000").Substring(0, 16)

End If

End Function

hey i got solution for exactly 16 number unique number using concat and guid method use this```

vengatesh

Dot net Developer

SGS Technologie