954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

vb.net with ms-access

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...

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 

You mean you want to generate serial invoice numbers?

Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 
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

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 
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
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 

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 .....

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 

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 ....

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 
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
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 

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

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 

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

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 

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

Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 

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

siva28
Newbie Poster
22 posts since Oct 2011
Reputation Points: 8
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: