prdshukla, Thanks for your opinion but i have already construct a logic structure... but my problem is for each row in my subitem column 3 each of them have the same ID, i want is a random id for each row. I am newbie in VB.net and i don't know how to manipulate for this kind of problem...
here's my sample code
<pre lang="vb">
Public Const A As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Public Const B As String = "0123456789"
lstLicense.Items.Clear()
lstLicense.Enabled = True
Dim strCodes As String
Dim strId As String
Dim strId2 As String
Dim zz As String
Dim item As ListViewItem
Dim random As New Random
strCodes = strCodes & A
strCodes = strCodes & B
Randomize()
For i = 0 To CInt(10) - 1
strId &= Mid(strCodes, Int(Len(strCodes) * Rnd()) + 1, 1)
Next
For i = 0 To CInt(4) - 1
strId2 &= Mid(strCodes, Int(Len(strCodes) * Rnd()) + 1, 1)
Next
zz = strId & "-" & strId2
txtPartNumber.Text = zz
For d As Integer = 0 To DataGridView1.Rows.Count - 2
With item
item = lstLicense.Items.Add(DataGridView1.Item(1, d).Value.ToString, 0)
item.SubItems.Add(DataGridView1.Item(3, d).Value.ToString)2
item.SubItems.Add(zz)
End With
Next