R
Rob Richardson
Greetings!
I am struggling to understand data binding in VB.Net, and it's slow
going.
I have a list box bound to a dataset that is filled from a SQL Server
table. In addition to the list box, I have two buttons on the form.
When I click one, a data adapter's Fill() method gets data into the
table, and the column the list box is bound to obligingly appears in
the list box. The other button merely displays a message box when it
is clicked.
If I click the first button, wait for the list box to fill, and then
click the second button without doing anything in the list box, the
message box appears. I can also click the X in the upper right corner
of the form, and the form will close. But if I click in the list box
to select a different record in the table and then click on the second
button, the button appears to be depressed as usual, but the message
box does not appear! The same thing happens with the X. Its
appearance changes as expected when I click on it, but the form stays
open.
The data objects were all created by dragging them from the Server
Explorer onto the form and configured with their appropriate
designers. The only code I wrote was a single line to call Fill() and
another line to call MessageBox.Show().
Why is the list box being so selfish?
The task I was trying to do when I saw this behavior was to get a
second control to change when I selected a new record in the list box.
I dropped a text box onto the form and bound it to one of the columns
in the same dataset and table the list box was bound to. I wanted to
see the contents of that text box change when a different record was
selected in the list box. It didn't happen. What do I have to do to
get that to happen?
Thanks very much!
Rob
I am struggling to understand data binding in VB.Net, and it's slow
going.
I have a list box bound to a dataset that is filled from a SQL Server
table. In addition to the list box, I have two buttons on the form.
When I click one, a data adapter's Fill() method gets data into the
table, and the column the list box is bound to obligingly appears in
the list box. The other button merely displays a message box when it
is clicked.
If I click the first button, wait for the list box to fill, and then
click the second button without doing anything in the list box, the
message box appears. I can also click the X in the upper right corner
of the form, and the form will close. But if I click in the list box
to select a different record in the table and then click on the second
button, the button appears to be depressed as usual, but the message
box does not appear! The same thing happens with the X. Its
appearance changes as expected when I click on it, but the form stays
open.
The data objects were all created by dragging them from the Server
Explorer onto the form and configured with their appropriate
designers. The only code I wrote was a single line to call Fill() and
another line to call MessageBox.Show().
Why is the list box being so selfish?
The task I was trying to do when I saw this behavior was to get a
second control to change when I selected a new record in the list box.
I dropped a text box onto the form and bound it to one of the columns
in the same dataset and table the list box was bound to. I wanted to
see the contents of that text box change when a different record was
selected in the list box. It didn't happen. What do I have to do to
get that to happen?
Thanks very much!
Rob