how to increment 4 digit number automatically in vb.net windows appln
for example:
dc0001-----this is first userid
next time i click new button the user id automatically increased to dc0002
likewise
anybody to help me
Dim id As String = TextBox1.Text 'the last id no is in textbox1. you can get it
from database
Dim number As Integer = id.Substring(2, 4)
If (number < 9) Then
TextBox1.Text = id.Insert(5, (number + 1).ToString()).Remove(6)
ElseIf (number < 99) Then
TextBox1.Text = id.Insert(4, (number + 1).ToString()).Remove(6)
ElseIf (number < 999) Then
TextBox1.Text = id.Insert(3, (number + 1).ToString()).Remove(6)
ElseIf (number < 9999) Then
TextBox1.Text = id.Insert(2, (number + 1).ToString()).Remove(6)
End If
it will work untill the no goes dc9999
all the best