i need code for vb.net 2008.
That is invoice system i have number in each invoice. my database invoice number is null. when i click tab automatically invoice number increased number 1 ( EC000 to EC001). I used tab control .
please reply...

Recommended Answers

All 10 Replies

You mean you want to generate serial invoice numbers?

You mean you want to generate serial invoice numbers?

Ya....for example EC000 is in access database . when i click tab automatically EC001 will appear in vb.net form . after that again stored new value into database

Private Sub AutoNumberNo()
    Dim myReader As SqlDataReader
    conn = GetConnect()
    conn.Open()
    Dim temp As String
    Try
    Dim sql As String = "SELECT MAX(NO) 'IDNumber' FROM Invoice "
    Dim comm As SqlCommand = New SqlCommand(sql, conn)
    myReader = comm.ExecuteReader
    If myReader.HasRows Then
    While myReader.Read()
    temp = myReader.Item("IDNumber") + 1
    End While
    End If
    myReader.Close()
    Catch ex As Exception
     
    End Try
    conn.Close()
    textboxId.Text = String.Concat(temp) ' result will appear in textboxID txtId
    End Sub

Private Sub AutoNumberNo()
Dim myReader As SqlDataReader
conn = GetConnect()
conn.Open()
Dim temp As String
Try
Dim sql As String = "SELECT MAX(NO) 'IDNumber' FROM Invoice "
Dim comm As SqlCommand = New SqlCommand(sql, conn)
myReader = comm.ExecuteReader
If myReader.HasRows Then
While myReader.Read()
temp = myReader.Item("IDNumber") + 1
End While
End If
myReader.Close()
Catch ex As Exception

End Try
conn.Close()
textboxId.Text = String.Concat(temp) ' result will appear in textboxID txtId
End Sub

this is not work properly ...please send clear code with database connection include .....

I need code for vb.net 2008 . That is i have invoice number automatic generation. i used tab control . when i clicked tab automatically invoice number generated which is already saved in database+1.
For example ..already my database have EC000 means , when i click tab automatically print EC001 . that is increment one.
please reply .

Private Sub TabPage3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage3.Click

End Sub

This is i used in vb.net form.......when i click this tab page automatically EC001 will appear in textbox... again i stored into new one.....please reply ....

this is not work properly ...please send clear code with database connection include

Simply call the subprocedure from the Button used for generating the sequence numbers like this:

Private Sub SerialButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SerialButton.Click

'Note: It is assumed that the button is named SerialButton
AutoNumberNo   'this calls this AutoNumberNo subprocedure

End Sub

Dim myReader As SqlDataReader
this is not work....

Private Sub AutoNumberNo()
Dim myReader As SqlDataReader
conn = GetConnect()
conn.Open()
Dim temp As String
Try
Dim sql As String = "SELECT MAX(NO) 'IDNumber' FROM Invoice "
Dim comm As SqlCommand = New SqlCommand(sql, conn)
myReader = comm.ExecuteReader
If myReader.HasRows Then
While myReader.Read()
temp = myReader.Item("IDNumber") + 1
End While
End If
myReader.Close()
Catch ex As Exception

End Try
conn.Close()
TextBox12.Text = String.Concat(temp) ' result will appear in textboxID txtId
End Sub

Private Sub TabPage3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage3.Click

Try
Dim conn As OleDbConnection = New OleDbConnection("provider=Microsoft.jet.oledb.4.0;data source=C:\Users\EPPLE CUBE\Desktop\WindowsApplication1\Invoice.mdb")
AutoNumberNo()


Catch ex As Exception

End Try

TextBox13.Text = System.DateTime.Today


End Sub
this is my form now....but code not work...please reply... send clear code

I assumed you were using SQL Server but since you're not, you can make the changes to that of Access

am newbe of vb.net ...please change the code on access dependent...please reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.