CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2001
    Location
    MA
    Posts
    11

    load .dbf file into a listbox

    I want to load a single dbase file into a listbox. Any suggestions would be great! Thanks.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: load .dbf file into a listbox

    Create a recordset for the field(s) that you need and enter it to the listbox.

    List1.AddItem rs!Field1 & " " & rs!Field2

    If you need a connection string for dbase, let me know

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Sep 2001
    Location
    MA
    Posts
    11

    Re: load .dbf file into a listbox

    Thanks for the tip. I know how to create a connection for a database that stays in one place. But my problem is that I want to allow the user to specify where the .dbf file is stored.

    For example, the user is asked to specify where the .dbf file is stored. Once they specify the location the .dbf files needs to be read into the listbox. I guess my question is how do I create a connection that is dynamic? My experience has only been with connecting to a database that stays in one place.


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: load .dbf file into a listbox

    On a button click bring an InputBox where user can enter the database path (or you can use Dialog Box). Assign path to the variable (DBFPATH) and then create the connection string

    sConn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=" & DBFPATH & ";"

    Here we go. We eill connect to the chosen location.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured