Results 1 to 3 of 3

Thread: AutoFill Text Boxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2002
    Location
    Georgia
    Posts
    27

    AutoFill Text Boxes

    Hello All,

    Anyone have a code for VB.net regarding AutoFilling TextBoxes or ComboBoxes with data froam an Access 2000 Database

    Thanks in advance

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    yeah sure.

    make an OleDbConnection, make an OleDbCommand, rite some sql to get the data you need then use the command to call it...

    like so

    VB Code:
    1. Option Explicit On
    2. Option Strict On
    3.  
    4. Module OleDb
    5.     Public Sub Main()
    6.         DoIt()
    7.     End Sub
    8.  
    9.     Public Sub DoIt()
    10.         Dim db As New System.Data.OleDb.OleDbConnection()
    11.         Dim dbCmd As New System.Data.OleDb.OleDbCommand()
    12.         Dim Form As New System.Windows.Forms.Form()
    13.         Dim i As System.Int32
    14.  
    15.         db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Windows.Forms.Application.StartupPath() & "\mDb.mdb;"
    16.         MsgBox(db.ConnectionString())
    17.         db.Open()
    18.         For i = 1 To 3
    19.             Form = New System.Windows.Forms.Form()
    20.  
    21.             dbCmd.Connection = db
    22.             dbCmd.CommandText = "Select FormCaption From blah Where ID=" & CStr(i) & ";"
    23.             Form.Text = CStr(dbCmd.ExecuteScalar())
    24.             Form.Show()
    25.             Form = Nothing
    26.         Next
    27.     End Sub
    28. End Module

    database is in attached zip
    Attached Files Attached Files
    Magiaus

    If I helped give me some points.

  3. #3
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    you will most likely want to use the DataReader though i posted an example of that on here already but it apears to have been purged
    Magiaus

    If I helped give me some points.

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