Public Sub autoGenerateNo()
Try
Dim dt As New DataTable
Dim item As String
Dim store As Integer
dt = objGeneral.FetchData()
' Dim adp As New OleDb.OleDbDataAdapter(strquery, con)
'adp.Fill(ds)
If (dt.Rows.Count = 0) Then
rec = 1
Else
item = dt.Rows(dt.Rows.Count - 1).Item(0)
Dim split() As String = item.Split(New [Char]() {"S"c})
For Each item In split
If item.Trim <> "" Then
store = item
End If
Next
rec = store + 1
End If
TextBox1.Text = "S" & rec.ToString()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Try
Dim dt As New DataTable
Dim item As String
Dim store As Integer
dt = objGeneral.FetchData()
' Dim adp As New OleDb.OleDbDataAdapter(strquery, con)
'adp.Fill(ds)
If (dt.Rows.Count = 0) Then
rec = 1
Else
item = dt.Rows(dt.Rows.Count - 1).Item(0)
Dim split() As String = item.Split(New [Char]() {"S"c})
For Each item In split
If item.Trim <> "" Then
store = item
End If
Next
rec = store + 1
End If
TextBox1.Text = "S" & rec.ToString()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
No comments:
Post a Comment