We help IT Professionals succeed at work.

How to open a different table using the same bindingsource - vb.net

Michael Meeks
on
554 Views
Last Modified: 2017-03-16
I have a simple Winforms App - with a database with 2 tables (tableOne TableTwo)
The form has 1 textbox that is bound to the dataset for tableOne.
There is no coding at this time.  
Run the program - Textbox shows the first record of the tableOne

The form has 1 button that says change table.
However, (when coding) - when I attempt to change TextBox from one table to another,
all I get is errors.

The database is the same - there is only 2 tables - how can I switch between the two tables for
textbox to display - when I click the button?

Thank You!
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Michael MeeksSystems Manager

Author

Commented:
Thank You !   Although VB2017 - doesn't like your (method 2 shown) - since in 2017 it has changed.

(Informational)
IDE0017 Object initialization can be simplified pops up.

(Error)
BC30455 Argument no specidifed for parmeter "metadataChange of 'Public Overloads Sub ResetBindings(metadataChanged as boolean)

When I remove method 2 - these both go away!

Strange,  But I do thank you for steering me in the right direction.  It's a big help.

Thank You!
Mike
Ark
CERTIFIED EXPERT

Commented:
(Error) BC30455 Argument no specidifed for parmeter "metadataChange of 'Public Overloads Sub ResetBindings(metadataChanged as boolean)
Sorry, should be bs.ResetBindings(False)