Home All Groups Group Topic Archive Search About

SImple ADO.Net problem

Author
11 Feb 2006 3:04 AM
Grumpy Aero Guy
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)

Author
11 Feb 2006 6:21 PM
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
Show quoteHide quote
"Grumpy Aero Guy" <fbachman@beer_me.com> wrote in message
news:u65hqfrLGHA.3856@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)
>
>
>
Author
12 Feb 2006 1:04 AM
Grumpy Aero Guy
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)


Show quoteHide quote
"CMM" <cmm@nospam.com> wrote in message
news:uxlUIgzLGHA.3960@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:u65hqfrLGHA.3856@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)
>>
>>
>>
>
>
Author
12 Feb 2006 2:04 AM
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