-
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 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.
-
<?>
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
-
<?>
If you want, zip your program and the database and send it to me and I will test it on VB6.
-
You have to use 'Set' when you change the Datasource
Code:
Set Text1.DataSource = Data1
Try that!