Results 1 to 20 of 20

Thread: Vb net record counter

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    24

    Vb net record counter

    Hello,
    I am trying to make a record counter for a textbox i have on my form. Basically i have an Access database called Member and wish too count how many records there are in the database and insert the figure into the textbox called MemberID. I am doing this to stop duplication in my form. I am doing it on the MemberID which is a Primary Key and not an autonumber.

    I have tried this code so far but i have had no luck
    vb.net Code:
    1. Public Class frmMember
    2.     Dim Include As Integer
    3.     Dim Connect As New OleDb.OleDbConnection
    4.     Dim DataSet As New DataSet
    5.     Dim DataAdapter As OleDb.OleDbDataAdapter
    6.     Dim StructuredQueryLanguage As String
    7.     Dim LastRow As Integer
    8.     Dim Maxrows As Integer
    9.  
    10. Private Sub btnNewRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewRecord.Click
    11.  txtMemberID.Text = DataSet.Tables("Members").Rows.Count
    12.         'Maxrows = DataSet.Tables("Members").Rows.Count
    13.         Include = +1
    I have got alot of code on my database. But i have tried using count so it goes up in order and the user wont have to enter anything into the textbox but i am really struggling to get it working.

    Any suggestion on fixing my problem would be grateful
    Thank You
    Last edited by Hack; Apr 25th, 2012 at 06:48 AM. Reason: Added Highlight Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width