flewis
Oct 5th, 2000, 06:50 PM
I suppose this just isn't possible? Does anyone have any suggestions here? Thanks.
REPOST:
Hello all. I am hoping that someone can give me a little guidance to a problem I have encounted recently.
Scenario: I am programming a contact manager/transaction manager program, and I have a form that lets the user query a database for certain customer profiles. Once the results are pulled into the recordset, it opens a new form that displays these results. I have a datagrid that displays certain fields of the query so the user can select customers and look at their entire profile below the grid. I want to bind text boxes to the data source (on this particular connection I have decided to use a dataenvironment for ease in reporting later). Binding the text boxes would be easy using the datasource, datafield, etc, but I want to be able to connocate fields and deal with null values through code, so that option is out (unless someone else has suggestions on ways to that). So what I need to know is how to bind text boxes to the datasource that will move along with the selection in the datagrid. Do I use a binding collection? I can't seem to create one that works.
Here's a small sample of my code:
Dim bndName As New BindingCollection
Private Sub Form_Load()
Set bndName.DataSource = DataEnvironment1
(Not correct syntax below, but you get the picture)
If FirstName <> "" Then
If LastName <> "" Then
bndName.Add txtName, "Text", "FirstName & ' ' &
LastName"
etc...that sort of logic...
End Sub
What is the proper way to do this? Is there a better way to gind to a datasource and still retain control over what goes into a text box? A regularly bound text box does not deal with null values well when one connocates a string.
Any advice would be greatly appreciated. Thank you.
fllewis
REPOST:
Hello all. I am hoping that someone can give me a little guidance to a problem I have encounted recently.
Scenario: I am programming a contact manager/transaction manager program, and I have a form that lets the user query a database for certain customer profiles. Once the results are pulled into the recordset, it opens a new form that displays these results. I have a datagrid that displays certain fields of the query so the user can select customers and look at their entire profile below the grid. I want to bind text boxes to the data source (on this particular connection I have decided to use a dataenvironment for ease in reporting later). Binding the text boxes would be easy using the datasource, datafield, etc, but I want to be able to connocate fields and deal with null values through code, so that option is out (unless someone else has suggestions on ways to that). So what I need to know is how to bind text boxes to the datasource that will move along with the selection in the datagrid. Do I use a binding collection? I can't seem to create one that works.
Here's a small sample of my code:
Dim bndName As New BindingCollection
Private Sub Form_Load()
Set bndName.DataSource = DataEnvironment1
(Not correct syntax below, but you get the picture)
If FirstName <> "" Then
If LastName <> "" Then
bndName.Add txtName, "Text", "FirstName & ' ' &
LastName"
etc...that sort of logic...
End Sub
What is the proper way to do this? Is there a better way to gind to a datasource and still retain control over what goes into a text box? A regularly bound text box does not deal with null values well when one connocates a string.
Any advice would be greatly appreciated. Thank you.
fllewis