By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

SImple ADO.Net problem

P: n/a
Set up a simple ADO.Net Windows app. Set everything up... fill data via

************************************************** *****************
Dim bmb As BindingManagerBase

:

:

Private Sub MemberDetail_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.daTrain.Fill(dsTrain.tblMaster)

bmb = Me.BindingContext(dsTrain.tblMaster)

End Sub

************************************************** *****************

Simple form with 3 text boxes representing three particular fields in the
table via data binding to appropriate fields.

Run App....

First record appears in text boxes as expected. so far so good....

Created a "Move Next Button via:

************************************************** *****************

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

bmb.Position += 1

End Sub

************************************************** *****************

Click button ... and... nothing. Can't get the record position to move on
the form.

So what stupid, simple thing am I overlooking??????

--
Frank Bachman
(Grumpy Aero Guy)

Feb 11 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
CMM
Your controls are probably not using that same bindingcontext. Try

bmb = Me.BindingContext(dsTrain, "tblMaster")
This returns a *different* binding manager than
BindingContext(dsTrain.tblMaster) believe it or not and it's probably the
one your controls are using.

Suggestion:
Because of BindingContext/BindingManager's trickyness... I have found it
infinitely helpful to use a DataView and bind to that rather than binding to
the dataset tables directly. It's simple, just drop a DataView onto your
form, associate it with the table, and change all your binding to use the
DataView.

Using DataViews solves all the confusing nuances with databinding.
--
-C. Moya
www.cmoya.com
"Grumpy Aero Guy" <fbachman@beer_me.com> wrote in message
news:u6**************@TK2MSFTNGP12.phx.gbl...
Set up a simple ADO.Net Windows app. Set everything up... fill data via

************************************************** *****************
Dim bmb As BindingManagerBase

:

:

Private Sub MemberDetail_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.daTrain.Fill(dsTrain.tblMaster)

bmb = Me.BindingContext(dsTrain.tblMaster)

End Sub

************************************************** *****************

Simple form with 3 text boxes representing three particular fields in the
table via data binding to appropriate fields.

Run App....

First record appears in text boxes as expected. so far so good....

Created a "Move Next Button via:

************************************************** *****************

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

bmb.Position += 1

End Sub

************************************************** *****************

Click button ... and... nothing. Can't get the record position to move on
the form.

So what stupid, simple thing am I overlooking??????

--
Frank Bachman
(Grumpy Aero Guy)

Feb 11 '06 #2

P: n/a
I changed it to xxxxx, "tblMaster" instead of xxxxx.tblmaster....

YOU WERE RIGHT....

Geez.... a little touchy I think.

I will research the dataview component.

Thank you !!!!!!!!!!

--
Frank Bachman
(Grumpy Aero Guy)
"CMM" <cm*@nospam.com> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl...
Your controls are probably not using that same bindingcontext. Try

bmb = Me.BindingContext(dsTrain, "tblMaster")
This returns a *different* binding manager than
BindingContext(dsTrain.tblMaster) believe it or not and it's probably the
one your controls are using.

Suggestion:
Because of BindingContext/BindingManager's trickyness... I have found it
infinitely helpful to use a DataView and bind to that rather than binding
to the dataset tables directly. It's simple, just drop a DataView onto
your form, associate it with the table, and change all your binding to use
the DataView.

Using DataViews solves all the confusing nuances with databinding.
--
-C. Moya
www.cmoya.com
"Grumpy Aero Guy" <fbachman@beer_me.com> wrote in message
news:u6**************@TK2MSFTNGP12.phx.gbl...
Set up a simple ADO.Net Windows app. Set everything up... fill data via

************************************************** *****************
Dim bmb As BindingManagerBase

:

:

Private Sub MemberDetail_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.daTrain.Fill(dsTrain.tblMaster)

bmb = Me.BindingContext(dsTrain.tblMaster)

End Sub

************************************************** *****************

Simple form with 3 text boxes representing three particular fields in the
table via data binding to appropriate fields.

Run App....

First record appears in text boxes as expected. so far so good....

Created a "Move Next Button via:

************************************************** *****************

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

bmb.Position += 1

End Sub

************************************************** *****************

Click button ... and... nothing. Can't get the record position to move on
the form.

So what stupid, simple thing am I overlooking??????

--
Frank Bachman
(Grumpy Aero Guy)


Feb 12 '06 #3

P: n/a
CMM
Yeah. Watch out this other non-intuitive "gotcha" below (but don't let these
"gotcha's" discourage you, once you wrap your mind around them, databinding
is extremely beneficial... and full-featured).

For instance, using a Datagrid:

DataSource=MyDataset1, DataMemeber=Table1
or
DataSource=MyDataset1.Table1

accomplish the same thing but produce DIFFERENT binding managers. Don't ask
me why. It leads to confusion when you try to create a Master/Details user
interface and then you can't figure out why your Details controls (textboxes
and stuff) don't sync up with your Master control (Datagrid for example)...
it's because behind the scenes they're using different CurrencyManagers.

Again, binding everything to DataView(s) simplies everything greatly. Plus
DataViews add additional features that Datasets don't possess. I like to
make it a "standard practice" to exclusively using binding with DataViews
rather than to the Dataset directly.

--
-C. Moya
www.cmoya.com
Feb 12 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.