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]() {"E"c})
For Each item In split
If item.Trim <> "" Then
store = item
End If
Next
rec = store + 1
End If
Dim crtYear As Integer = DateTime.Now.Year
Dim prevYear As Integer = DateTime.Now.Year - 1
TextBox1.Text = "E" & crtYear & prevYear & 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]() {"E"c})
For Each item In split
If item.Trim <> "" Then
store = item
End If
Next
rec = store + 1
End If
Dim crtYear As Integer = DateTime.Now.Year
Dim prevYear As Integer = DateTime.Now.Year - 1
TextBox1.Text = "E" & crtYear & prevYear & rec.ToString()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
No comments:
Post a Comment