Results 1 to 5 of 5

Thread: bound controls

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    25

    Talking

    When you run the project and open a dbf file with a commondialog box, it sets the data1 source (the databse file) to the file the user chose. How do i set up the bound text boxes to pull the data from the database when the user selects the file from the dialog box?

    hope this question makes sense.


    thanks in advance.
    If you reach total enlightenment while drinking a beer, I bet it makes beer shoot out your nose.

    VB5 Enterprise SP3

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    If I understand your question correctly then just set the datasource of the textbox to the user choice.

    text1.Datasource = data1 'User's choice
    Hope this helps.
    ande211
    VB6 SP3

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command2_Click()
    'display the commondialog show open
        
        CommonDialog1.InitDir = "C:\"          'set dir path
        CommonDialog1.CancelError = True               'used in cancel code
        CommonDialog1.Filter = "All files(*.*)|*.*"    'filter for all files
        CommonDialog1.ShowOpen                         'show files
        Data1.Database = CommonDialog1.FileName
        Text1.DataSource = Data1
        Text1.DataField = "yourfield"
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    If you want, zip your program and the database and send it to me and I will test it on VB6.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You have to use 'Set' when you change the Datasource
    Code:
    Set Text1.DataSource = Data1
    Try that!

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