473,791 Members | 3,090 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorry to Re-Post - Databindings problem

Hey Group,

Sorry but i`ve been searching everywhere for this even went out and bought a
ADO book and still carn`t find what im looking for:(

I have the following code for my postion changed:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess,
"Users").Count. ToString)
End Sub

This works fine, with my Combo Box. My ComboBox is using the following code:

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
mlLoading Then
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue
End If
End Sub

This all works fine, if im using Navigation buttons and calling:
Me.objdsAccess_ PositionChanged ().

However I`ve now added a Datagrid to my Form, as I select a Row in my form.
How would i get it to update my ComboBox, and notice the position changed?

Thanks
MCN
Nov 20 '05 #1
12 1238
If they are associated with the same currency manager it will do it
automatically.

However, the probably isn't the case. anyways, in ADO.NET you have these
things called CurrencyManager s that basically act kinda like an old
ADODB.Recordset (yes like many things in .NET). Anyways, CurrencyManager s
are created from bindings (actually you get them from the bindingContext of
the control).

This CurrencyManager is automatically subscribed the the datagrid events (or
vise versa, either way, upon changing the position in a datagrid (i.e moving
to a new row) the currency managers position is changed for you and an event
is fired.

so the best way to handle this is.

In your class delcaration do this...

Private WithEvents _cmMyDataset as CurrencyManager

Then in your form load (best place I think, you can do it others like in
your constructor, but not really a big deal.

_cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")

Obviously replace those with valid values for your dataset and datatable.

Then, in your property browser on the top left (the drop down) you can find
the variable _cmMyDataSet Variable and the events associated with it on the
right.

Subscribe to the PositionChanged event, and then you can do whatever you
want. (i.e something with your combobox based on new row data).

CurrencyMangers are also INCREDIBLY useful when doing record manipulation,
because you can actually turn off the binding using the .SuspendBinding ()
and .ResumeBinding( ) methods, so if your working with large lists (i.e.
filling a large dataset) you can use suspendbinding while your filling it
(otherwise, every time an item is added it goes through the process of
repainting a control because of the ListChanged event on an IListSource
item.

HTH,
CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:yG******** ************@ka roo.co.uk...
Hey Group,

Sorry but i`ve been searching everywhere for this even went out and bought a ADO book and still carn`t find what im looking for:(

I have the following code for my postion changed:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess, "Users").Count. ToString)
End Sub

This works fine, with my Combo Box. My ComboBox is using the following code:
Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal e
As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
mlLoading Then
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue
End If
End Sub

This all works fine, if im using Navigation buttons and calling:
Me.objdsAccess_ PositionChanged ().

However I`ve now added a Datagrid to my Form, as I select a Row in my form. How would i get it to update my ComboBox, and notice the position changed?

Thanks
MCN

Nov 20 '05 #2
Hey CJ,

Hows you doing?

Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my
Class Decleration and then added cmDsAccess = BindingContext( objdsAccess,
"Users") in my form load.

How would i now get it to change my bindings on my textboxs, and Combo box
as i select rows in my Datagrid?

ManyThanks
MCN(Si)

By Datasource, do you mean the
"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
If they are associated with the same currency manager it will do it
automatically.

However, the probably isn't the case. anyways, in ADO.NET you have these
things called CurrencyManager s that basically act kinda like an old
ADODB.Recordset (yes like many things in .NET). Anyways, CurrencyManager s
are created from bindings (actually you get them from the bindingContext of the control).

This CurrencyManager is automatically subscribed the the datagrid events (or vise versa, either way, upon changing the position in a datagrid (i.e moving to a new row) the currency managers position is changed for you and an event is fired.

so the best way to handle this is.

In your class delcaration do this...

Private WithEvents _cmMyDataset as CurrencyManager

Then in your form load (best place I think, you can do it others like in
your constructor, but not really a big deal.

_cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")

Obviously replace those with valid values for your dataset and datatable.

Then, in your property browser on the top left (the drop down) you can find the variable _cmMyDataSet Variable and the events associated with it on the right.

Subscribe to the PositionChanged event, and then you can do whatever you
want. (i.e something with your combobox based on new row data).

CurrencyMangers are also INCREDIBLY useful when doing record manipulation,
because you can actually turn off the binding using the .SuspendBinding ()
and .ResumeBinding( ) methods, so if your working with large lists (i.e.
filling a large dataset) you can use suspendbinding while your filling it
(otherwise, every time an item is added it goes through the process of
repainting a control because of the ListChanged event on an IListSource
item.

HTH,
CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:yG******** ************@ka roo.co.uk...
Hey Group,

Sorry but i`ve been searching everywhere for this even went out and bought
a
ADO book and still carn`t find what im looking for:(

I have the following code for my postion changed:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") +

Me.BindingConte xt(objdsAccess,
"Users").Count. ToString)
End Sub

This works fine, with my Combo Box. My ComboBox is using the following

code:

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal

e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
mlLoading Then
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue
End If
End Sub

This all works fine, if im using Navigation buttons and calling:
Me.objdsAccess_ PositionChanged ().

However I`ve now added a Datagrid to my Form, as I select a Row in my

form.
How would i get it to update my ComboBox, and notice the position changed?
Thanks
MCN


Nov 20 '05 #3
Simon,

since you declared your cmDsAccess WithEvents you can look up in the top
left dropdown where it describes all you objects etc (like textboxes and so
on).

in there you will see your cmDsAccess object. If you click on it, you'll
see the events on the right side combo box. One of those will be position
changed.

click it (subscribing to it) and then that is your notifcation that the row
position has changed within your datagrid. At that point, you can do
whatever you want. for exmaple, on your position chaged event you can get
the current row from the currency manager (cmDsAccess.Cur rent()) and
maniuplate your combo boxes based off that.

How are things? Things are busy as sh**

=)

-CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:Dc******** ************@ka roo.co.uk...
Hey CJ,

Hows you doing?

Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my
Class Decleration and then added cmDsAccess = BindingContext( objdsAccess,
"Users") in my form load.

How would i now get it to change my bindings on my textboxs, and Combo box
as i select rows in my Datagrid?

ManyThanks
MCN(Si)

By Datasource, do you mean the
"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
If they are associated with the same currency manager it will do it
automatically.

However, the probably isn't the case. anyways, in ADO.NET you have these
things called CurrencyManager s that basically act kinda like an old
ADODB.Recordset (yes like many things in .NET). Anyways, CurrencyManager s are created from bindings (actually you get them from the bindingContext of
the control).

This CurrencyManager is automatically subscribed the the datagrid events

(or
vise versa, either way, upon changing the position in a datagrid (i.e

moving
to a new row) the currency managers position is changed for you and an

event
is fired.

so the best way to handle this is.

In your class delcaration do this...

Private WithEvents _cmMyDataset as CurrencyManager

Then in your form load (best place I think, you can do it others like in
your constructor, but not really a big deal.

_cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")

Obviously replace those with valid values for your dataset and datatable.
Then, in your property browser on the top left (the drop down) you can

find
the variable _cmMyDataSet Variable and the events associated with it on

the
right.

Subscribe to the PositionChanged event, and then you can do whatever you
want. (i.e something with your combobox based on new row data).

CurrencyMangers are also INCREDIBLY useful when doing record manipulation, because you can actually turn off the binding using the ..SuspendBindin g() and .ResumeBinding( ) methods, so if your working with large lists (i.e.
filling a large dataset) you can use suspendbinding while your filling it (otherwise, every time an item is added it goes through the process of
repainting a control because of the ListChanged event on an IListSource
item.

HTH,
CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:yG******** ************@ka roo.co.uk...
Hey Group,

Sorry but i`ve been searching everywhere for this even went out and

bought
a
ADO book and still carn`t find what im looking for:(

I have the following code for my postion changed:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") +

Me.BindingConte xt(objdsAccess,
"Users").Count. ToString)
End Sub

This works fine, with my Combo Box. My ComboBox is using the following

code:

Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object,

ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
mlLoading Then
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue
End If
End Sub

This all works fine, if im using Navigation buttons and calling:
Me.objdsAccess_ PositionChanged ().

However I`ve now added a Datagrid to my Form, as I select a Row in my

form.
How would i get it to update my ComboBox, and notice the position changed?
Thanks
MCN



Nov 20 '05 #4
CJ

Im not to bad been really busy with work and wot not:( All work and no
play:(

Anyways ....... I`ve looked in my propery Browser but i carn`t seem to find
cmDsAccess anywhere in there:(

Any Ideas?

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Simon,

since you declared your cmDsAccess WithEvents you can look up in the top
left dropdown where it describes all you objects etc (like textboxes and so on).

in there you will see your cmDsAccess object. If you click on it, you'll
see the events on the right side combo box. One of those will be position
changed.

click it (subscribing to it) and then that is your notifcation that the row position has changed within your datagrid. At that point, you can do
whatever you want. for exmaple, on your position chaged event you can get
the current row from the currency manager (cmDsAccess.Cur rent()) and
maniuplate your combo boxes based off that.

How are things? Things are busy as sh**

=)

-CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:Dc******** ************@ka roo.co.uk...
Hey CJ,

Hows you doing?

Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my
Class Decleration and then added cmDsAccess = BindingContext( objdsAccess,
"Users") in my form load.

How would i now get it to change my bindings on my textboxs, and Combo box as i select rows in my Datagrid?

ManyThanks
MCN(Si)

By Datasource, do you mean the
"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
If they are associated with the same currency manager it will do it
automatically.

However, the probably isn't the case. anyways, in ADO.NET you have these things called CurrencyManager s that basically act kinda like an old
ADODB.Recordset (yes like many things in .NET). Anyways, CurrencyManager s are created from bindings (actually you get them from the bindingContext of
the control).

This CurrencyManager is automatically subscribed the the datagrid
events
(or
vise versa, either way, upon changing the position in a datagrid (i.e

moving
to a new row) the currency managers position is changed for you and an

event
is fired.

so the best way to handle this is.

In your class delcaration do this...

Private WithEvents _cmMyDataset as CurrencyManager

Then in your form load (best place I think, you can do it others like
in your constructor, but not really a big deal.

_cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")

Obviously replace those with valid values for your dataset and

datatable.
Then, in your property browser on the top left (the drop down) you can

find
the variable _cmMyDataSet Variable and the events associated with it on the
right.

Subscribe to the PositionChanged event, and then you can do whatever
you want. (i.e something with your combobox based on new row data).

CurrencyMangers are also INCREDIBLY useful when doing record

manipulation, because you can actually turn off the binding using the .SuspendBinding () and .ResumeBinding( ) methods, so if your working with large lists (i.e. filling a large dataset) you can use suspendbinding while your filling it (otherwise, every time an item is added it goes through the process of
repainting a control because of the ListChanged event on an IListSource item.

HTH,
CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:yG******** ************@ka roo.co.uk...
> Hey Group,
>
> Sorry but i`ve been searching everywhere for this even went out and

bought
a
> ADO book and still carn`t find what im looking for:(
>
> I have the following code for my postion changed:
>
> Private Sub objdsAccess_Pos itionChanged()
> If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
> Me.ComboBox1.Se lectedValue =
> objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> "Users").Positi on).Item("Acces sLevelID")
> End If
> Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
> "Users").Positi on + 1).ToString + " of ") +
Me.BindingConte xt(objdsAccess,
> "Users").Count. ToString)
> End Sub
>
> This works fine, with my Combo Box. My ComboBox is using the following code:
>
> Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object,

ByVal
e
> As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
> If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not > mlLoading Then
> objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> "Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue > End If
> End Sub
>
> This all works fine, if im using Navigation buttons and calling:
> Me.objdsAccess_ PositionChanged ().
>
> However I`ve now added a Datagrid to my Form, as I select a Row in my form.
> How would i get it to update my ComboBox, and notice the position

changed?
>
> Thanks
> MCN
>
>



Nov 20 '05 #5
Go to your Code Window... Look at the combo box on the top left side.. you
can't miss it.. there are two of them. right above your code. look there.
=)


"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:iv******** ************@ka roo.co.uk...
CJ

Im not to bad been really busy with work and wot not:( All work and no
play:(

Anyways ....... I`ve looked in my propery Browser but i carn`t seem to find cmDsAccess anywhere in there:(

Any Ideas?

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Simon,

since you declared your cmDsAccess WithEvents you can look up in the top
left dropdown where it describes all you objects etc (like textboxes and so
on).

in there you will see your cmDsAccess object. If you click on it, you'll
see the events on the right side combo box. One of those will be position changed.

click it (subscribing to it) and then that is your notifcation that the

row
position has changed within your datagrid. At that point, you can do
whatever you want. for exmaple, on your position chaged event you can get the current row from the currency manager (cmDsAccess.Cur rent()) and
maniuplate your combo boxes based off that.

How are things? Things are busy as sh**

=)

-CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:Dc******** ************@ka roo.co.uk...
Hey CJ,

Hows you doing?

Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my Class Decleration and then added cmDsAccess = BindingContext( objdsAccess, "Users") in my form load.

How would i now get it to change my bindings on my textboxs, and Combo box as i select rows in my Datagrid?

ManyThanks
MCN(Si)

By Datasource, do you mean the
"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
> If they are associated with the same currency manager it will do it
> automatically.
>
> However, the probably isn't the case. anyways, in ADO.NET you have

these
> things called CurrencyManager s that basically act kinda like an old
> ADODB.Recordset (yes like many things in .NET). Anyways,

CurrencyManager s
> are created from bindings (actually you get them from the bindingContext of
> the control).
>
> This CurrencyManager is automatically subscribed the the datagrid events (or
> vise versa, either way, upon changing the position in a datagrid (i.e moving
> to a new row) the currency managers position is changed for you and an event
> is fired.
>
> so the best way to handle this is.
>
> In your class delcaration do this...
>
> Private WithEvents _cmMyDataset as CurrencyManager
>
> Then in your form load (best place I think, you can do it others like in
> your constructor, but not really a big deal.
>
> _cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")
>
> Obviously replace those with valid values for your dataset and

datatable.
>
> Then, in your property browser on the top left (the drop down) you
can find
> the variable _cmMyDataSet Variable and the events associated with it

on the
> right.
>
> Subscribe to the PositionChanged event, and then you can do whatever you > want. (i.e something with your combobox based on new row data).
>
> CurrencyMangers are also INCREDIBLY useful when doing record

manipulation,
> because you can actually turn off the binding using the

.SuspendBinding ()
> and .ResumeBinding( ) methods, so if your working with large lists (i.e. > filling a large dataset) you can use suspendbinding while your filling it
> (otherwise, every time an item is added it goes through the process
of > repainting a control because of the ListChanged event on an

IListSource > item.
>
> HTH,
> CJ
>
>
>
>
>
> "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> news:yG******** ************@ka roo.co.uk...
> > Hey Group,
> >
> > Sorry but i`ve been searching everywhere for this even went out and bought
> a
> > ADO book and still carn`t find what im looking for:(
> >
> > I have the following code for my postion changed:
> >
> > Private Sub objdsAccess_Pos itionChanged()
> > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
> > Me.ComboBox1.Se lectedValue =
> > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > "Users").Positi on).Item("Acces sLevelID")
> > End If
> > Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
> > "Users").Positi on + 1).ToString + " of ") +
> Me.BindingConte xt(objdsAccess,
> > "Users").Count. ToString)
> > End Sub
> >
> > This works fine, with my Combo Box. My ComboBox is using the following > code:
> >
> > Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object,

ByVal
e
> > As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
> > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not > > mlLoading Then
> > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > "Users").Positi on).Item("Acces sLevelID") = Me.ComboBox1.Se lectedValue > > End If
> > End Sub
> >
> > This all works fine, if im using Navigation buttons and calling:
> > Me.objdsAccess_ PositionChanged ().
> >
> > However I`ve now added a Datagrid to my Form, as I select a Row in my > form.
> > How would i get it to update my ComboBox, and notice the position
changed?
> >
> > Thanks
> > MCN
> >
> >
>
>



Nov 20 '05 #6
Sorry CJ, I Must be going blind.

I think im going mad aswell and probably missing the point:(

How do i get it to do my positions changed? I have my Nav buttons setup to
call: Me.objDsAccess_ PositionChanged .

My Position Change code is as follows:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess,
"Users").Count. ToString)
End Sub

How do i get this to work for my Datagrid. Do I need a:
Datagrid1_Selec tedIndexChanged . Sorry i don`t know where to call a datgird
PostionChanged from or am I barking up the wrong tree?

Sorry to be a pain.

Cheers
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Go to your Code Window... Look at the combo box on the top left side.. you can't miss it.. there are two of them. right above your code. look there. =)


"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:iv******** ************@ka roo.co.uk...
CJ

Im not to bad been really busy with work and wot not:( All work and no
play:(

Anyways ....... I`ve looked in my propery Browser but i carn`t seem to find
cmDsAccess anywhere in there:(

Any Ideas?

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Simon,

since you declared your cmDsAccess WithEvents you can look up in the top left dropdown where it describes all you objects etc (like textboxes and
so
on).

in there you will see your cmDsAccess object. If you click on it, you'll see the events on the right side combo box. One of those will be position changed.

click it (subscribing to it) and then that is your notifcation that
the
row
position has changed within your datagrid. At that point, you can do
whatever you want. for exmaple, on your position chaged event you can get the current row from the currency manager (cmDsAccess.Cur rent()) and
maniuplate your combo boxes based off that.

How are things? Things are busy as sh**

=)

-CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:Dc******** ************@ka roo.co.uk...
> Hey CJ,
>
> Hows you doing?
>
> Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my > Class Decleration and then added cmDsAccess =

BindingContext( objdsAccess,
> "Users") in my form load.
>
> How would i now get it to change my bindings on my textboxs, and
Combo box
> as i select rows in my Datagrid?
>
> ManyThanks
> MCN(Si)
>
> By Datasource, do you mean the
> "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> news:10******** *****@corp.supe rnews.com...
> > If they are associated with the same currency manager it will do
it > > automatically.
> >
> > However, the probably isn't the case. anyways, in ADO.NET you have these
> > things called CurrencyManager s that basically act kinda like an old > > ADODB.Recordset (yes like many things in .NET). Anyways,
CurrencyManager s
> > are created from bindings (actually you get them from the

bindingContext
> of
> > the control).
> >
> > This CurrencyManager is automatically subscribed the the datagrid

events
> (or
> > vise versa, either way, upon changing the position in a datagrid

(i.e > moving
> > to a new row) the currency managers position is changed for you and an
> event
> > is fired.
> >
> > so the best way to handle this is.
> >
> > In your class delcaration do this...
> >
> > Private WithEvents _cmMyDataset as CurrencyManager
> >
> > Then in your form load (best place I think, you can do it others like
in
> > your constructor, but not really a big deal.
> >
> > _cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")
> >
> > Obviously replace those with valid values for your dataset and
datatable.
> >
> > Then, in your property browser on the top left (the drop down) you
can > find
> > the variable _cmMyDataSet Variable and the events associated with
it on
> the
> > right.
> >
> > Subscribe to the PositionChanged event, and then you can do
whatever you
> > want. (i.e something with your combobox based on new row data).
> >
> > CurrencyMangers are also INCREDIBLY useful when doing record
manipulation,
> > because you can actually turn off the binding using the
.SuspendBinding ()
> > and .ResumeBinding( ) methods, so if your working with large lists

(i.e.
> > filling a large dataset) you can use suspendbinding while your filling it
> > (otherwise, every time an item is added it goes through the
process of > > repainting a control because of the ListChanged event on an

IListSource
> > item.
> >
> > HTH,
> > CJ
> >
> >
> >
> >
> >
> > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > news:yG******** ************@ka roo.co.uk...
> > > Hey Group,
> > >
> > > Sorry but i`ve been searching everywhere for this even went out and > bought
> > a
> > > ADO book and still carn`t find what im looking for:(
> > >
> > > I have the following code for my postion changed:
> > >
> > > Private Sub objdsAccess_Pos itionChanged()
> > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1

Then > > > Me.ComboBox1.Se lectedValue =
> > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > "Users").Positi on).Item("Acces sLevelID")
> > > End If
> > > Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
> > > "Users").Positi on + 1).ToString + " of ") +
> > Me.BindingConte xt(objdsAccess,
> > > "Users").Count. ToString)
> > > End Sub
> > >
> > > This works fine, with my Combo Box. My ComboBox is using the

following
> > code:
> > >
> > > Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, ByVal
> e
> > > As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
> > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
> > > mlLoading Then
> > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > "Users").Positi on).Item("Acces sLevelID") =

Me.ComboBox1.Se lectedValue
> > > End If
> > > End Sub
> > >
> > > This all works fine, if im using Navigation buttons and calling:
> > > Me.objdsAccess_ PositionChanged ().
> > >
> > > However I`ve now added a Datagrid to my Form, as I select a Row
in my
> > form.
> > > How would i get it to update my ComboBox, and notice the

position > changed?
> > >
> > > Thanks
> > > MCN
> > >
> > >
> >
> >
>
>



Nov 20 '05 #7
Killin me dog.

Alright, lets back it up a little bit. =)

1) objdsAccess_Pos itionChanged()

How is this called? what causes this to be called.?

2) Me.BindingConte xt(objdsAccess, "Users").

that right there is a currency manager. you can assign a variable to it,
makes things easier. Is your datagrid bound to this datatable on the
objDsAccess? what table is it bound to?

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:u7******** ************@ka roo.co.uk...
Sorry CJ, I Must be going blind.

I think im going mad aswell and probably missing the point:(

How do i get it to do my positions changed? I have my Nav buttons setup to
call: Me.objDsAccess_ PositionChanged .

My Position Change code is as follows:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess,
"Users").Count. ToString)
End Sub

How do i get this to work for my Datagrid. Do I need a:
Datagrid1_Selec tedIndexChanged . Sorry i don`t know where to call a datgird
PostionChanged from or am I barking up the wrong tree?

Sorry to be a pain.

Cheers
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Go to your Code Window... Look at the combo box on the top left side.. you
can't miss it.. there are two of them. right above your code. look

there.
=)


"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:iv******** ************@ka roo.co.uk...
CJ

Im not to bad been really busy with work and wot not:( All work and no
play:(

Anyways ....... I`ve looked in my propery Browser but i carn`t seem to

find
cmDsAccess anywhere in there:(

Any Ideas?

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
> Simon,
>
> since you declared your cmDsAccess WithEvents you can look up in the top > left dropdown where it describes all you objects etc (like textboxes and so
> on).
>
> in there you will see your cmDsAccess object. If you click on it,

you'll
> see the events on the right side combo box. One of those will be

position
> changed.
>
> click it (subscribing to it) and then that is your notifcation that the row
> position has changed within your datagrid. At that point, you can do > whatever you want. for exmaple, on your position chaged event you can
get
> the current row from the currency manager (cmDsAccess.Cur rent()) and
> maniuplate your combo boxes based off that.
>
> How are things? Things are busy as sh**
>
> =)
>
> -CJ
>
> "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> news:Dc******** ************@ka roo.co.uk...
> > Hey CJ,
> >
> > Hows you doing?
> >
> > Right i`ve added Private WithEvents cmDsAccess As CurrencyManager
in
my
> > Class Decleration and then added cmDsAccess =
BindingContext( objdsAccess,
> > "Users") in my form load.
> >
> > How would i now get it to change my bindings on my textboxs, and Combo box
> > as i select rows in my Datagrid?
> >
> > ManyThanks
> > MCN(Si)
> >
> > By Datasource, do you mean the
> > "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> > news:10******** *****@corp.supe rnews.com...
> > > If they are associated with the same currency manager it will do it > > > automatically.
> > >
> > > However, the probably isn't the case. anyways, in ADO.NET you have > these
> > > things called CurrencyManager s that basically act kinda like an old > > > ADODB.Recordset (yes like many things in .NET). Anyways,
> CurrencyManager s
> > > are created from bindings (actually you get them from the
bindingContext
> > of
> > > the control).
> > >
> > > This CurrencyManager is automatically subscribed the the
datagrid events
> > (or
> > > vise versa, either way, upon changing the position in a datagrid

(i.e
> > moving
> > > to a new row) the currency managers position is changed for you

and
an
> > event
> > > is fired.
> > >
> > > so the best way to handle this is.
> > >
> > > In your class delcaration do this...
> > >
> > > Private WithEvents _cmMyDataset as CurrencyManager
> > >
> > > Then in your form load (best place I think, you can do it others

like
in
> > > your constructor, but not really a big deal.
> > >
> > > _cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")
> > >
> > > Obviously replace those with valid values for your dataset and
> datatable.
> > >
> > > Then, in your property browser on the top left (the drop down) you can
> > find
> > > the variable _cmMyDataSet Variable and the events associated
with it on
> > the
> > > right.
> > >
> > > Subscribe to the PositionChanged event, and then you can do whatever you
> > > want. (i.e something with your combobox based on new row data).
> > >
> > > CurrencyMangers are also INCREDIBLY useful when doing record
> manipulation,
> > > because you can actually turn off the binding using the
> .SuspendBinding ()
> > > and .ResumeBinding( ) methods, so if your working with large
lists (i.e.
> > > filling a large dataset) you can use suspendbinding while your filling
> it
> > > (otherwise, every time an item is added it goes through the

process
of
> > > repainting a control because of the ListChanged event on an
IListSource
> > > item.
> > >
> > > HTH,
> > > CJ
> > >
> > >
> > >
> > >
> > >
> > > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > > news:yG******** ************@ka roo.co.uk...
> > > > Hey Group,
> > > >
> > > > Sorry but i`ve been searching everywhere for this even went out and
> > bought
> > > a
> > > > ADO book and still carn`t find what im looking for:(
> > > >
> > > > I have the following code for my postion changed:
> > > >
> > > > Private Sub objdsAccess_Pos itionChanged()
> > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1

Then > > > > Me.ComboBox1.Se lectedValue =
> > > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > > "Users").Positi on).Item("Acces sLevelID")
> > > > End If
> > > > Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
> > > > "Users").Positi on + 1).ToString + " of ") +
> > > Me.BindingConte xt(objdsAccess,
> > > > "Users").Count. ToString)
> > > > End Sub
> > > >
> > > > This works fine, with my Combo Box. My ComboBox is using the
following
> > > code:
> > > >
> > > > Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As Object, > ByVal
> > e
> > > > As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
> > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 And Not
> > > > mlLoading Then
> > > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > > "Users").Positi on).Item("Acces sLevelID") =
Me.ComboBox1.Se lectedValue
> > > > End If
> > > > End Sub
> > > >
> > > > This all works fine, if im using Navigation buttons and
calling: > > > > Me.objdsAccess_ PositionChanged ().
> > > >
> > > > However I`ve now added a Datagrid to my Form, as I select a

Row in my
> > > form.
> > > > How would i get it to update my ComboBox, and notice the position > > changed?
> > > >
> > > > Thanks
> > > > MCN
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 20 '05 #8
From my Nav buttons I call objDsAccess_Pos titionChanged() for example:

Private Sub btnNavFirst_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnNavFirst.Cli ck
Me.BindingConte xt(objdsAccess, "Users").Positi on = 0
Me.objdsAccess_ PositionChanged ()
End Sub

My Datatable is bound to objdsAccess.Use rs.

I have a relationship Setup from my Users Table, AccessID row to my
AccessLevel Table AccessID.

My AccessLevelID Table has a AccessLevel Feild in it to which my ComboBox
Looks at.

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Killin me dog.

Alright, lets back it up a little bit. =)

1) objdsAccess_Pos itionChanged()

How is this called? what causes this to be called.?

2) Me.BindingConte xt(objdsAccess, "Users").

that right there is a currency manager. you can assign a variable to it,
makes things easier. Is your datagrid bound to this datatable on the
objDsAccess? what table is it bound to?

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:u7******** ************@ka roo.co.uk...
Sorry CJ, I Must be going blind.

I think im going mad aswell and probably missing the point:(

How do i get it to do my positions changed? I have my Nav buttons setup to
call: Me.objDsAccess_ PositionChanged .

My Position Change code is as follows:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess, "Users").Count. ToString)
End Sub

How do i get this to work for my Datagrid. Do I need a:
Datagrid1_Selec tedIndexChanged . Sorry i don`t know where to call a datgird PostionChanged from or am I barking up the wrong tree?

Sorry to be a pain.

Cheers
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Go to your Code Window... Look at the combo box on the top left side..
you
can't miss it.. there are two of them. right above your code. look there.
=)


"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:iv******** ************@ka roo.co.uk...
> CJ
>
> Im not to bad been really busy with work and wot not:( All work and
no > play:(
>
> Anyways ....... I`ve looked in my propery Browser but i carn`t seem to find
> cmDsAccess anywhere in there:(
>
> Any Ideas?
>
> Ta
> MCN(Si)
>
> "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> news:10******** *****@corp.supe rnews.com...
> > Simon,
> >
> > since you declared your cmDsAccess WithEvents you can look up in the top
> > left dropdown where it describes all you objects etc (like
textboxes and
> so
> > on).
> >
> > in there you will see your cmDsAccess object. If you click on it,
you'll
> > see the events on the right side combo box. One of those will be
position
> > changed.
> >
> > click it (subscribing to it) and then that is your notifcation
that the
> row
> > position has changed within your datagrid. At that point, you can do > > whatever you want. for exmaple, on your position chaged event you can get
> > the current row from the currency manager (cmDsAccess.Cur rent())
and > > maniuplate your combo boxes based off that.
> >
> > How are things? Things are busy as sh**
> >
> > =)
> >
> > -CJ
> >
> > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > news:Dc******** ************@ka roo.co.uk...
> > > Hey CJ,
> > >
> > > Hows you doing?
> > >
> > > Right i`ve added Private WithEvents cmDsAccess As CurrencyManager in my
> > > Class Decleration and then added cmDsAccess =
> BindingContext( objdsAccess,
> > > "Users") in my form load.
> > >
> > > How would i now get it to change my bindings on my textboxs, and

Combo
> box
> > > as i select rows in my Datagrid?
> > >
> > > ManyThanks
> > > MCN(Si)
> > >
> > > By Datasource, do you mean the
> > > "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> > > news:10******** *****@corp.supe rnews.com...
> > > > If they are associated with the same currency manager it will
do it
> > > > automatically.
> > > >
> > > > However, the probably isn't the case. anyways, in ADO.NET you

have
> > these
> > > > things called CurrencyManager s that basically act kinda like
an old
> > > > ADODB.Recordset (yes like many things in .NET). Anyways,
> > CurrencyManager s
> > > > are created from bindings (actually you get them from the
> bindingContext
> > > of
> > > > the control).
> > > >
> > > > This CurrencyManager is automatically subscribed the the datagrid > events
> > > (or
> > > > vise versa, either way, upon changing the position in a
datagrid (i.e
> > > moving
> > > > to a new row) the currency managers position is changed for you and
an
> > > event
> > > > is fired.
> > > >
> > > > so the best way to handle this is.
> > > >
> > > > In your class delcaration do this...
> > > >
> > > > Private WithEvents _cmMyDataset as CurrencyManager
> > > >
> > > > Then in your form load (best place I think, you can do it
others like
> in
> > > > your constructor, but not really a big deal.
> > > >
> > > > _cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")
> > > >
> > > > Obviously replace those with valid values for your dataset and
> > datatable.
> > > >
> > > > Then, in your property browser on the top left (the drop down)

you can
> > > find
> > > > the variable _cmMyDataSet Variable and the events associated with
it
> on
> > > the
> > > > right.
> > > >
> > > > Subscribe to the PositionChanged event, and then you can do

whatever
> you
> > > > want. (i.e something with your combobox based on new row data). > > > >
> > > > CurrencyMangers are also INCREDIBLY useful when doing record
> > manipulation,
> > > > because you can actually turn off the binding using the
> > .SuspendBinding ()
> > > > and .ResumeBinding( ) methods, so if your working with large

lists > (i.e.
> > > > filling a large dataset) you can use suspendbinding while your
filling
> > it
> > > > (otherwise, every time an item is added it goes through the

process
of
> > > > repainting a control because of the ListChanged event on an
> IListSource
> > > > item.
> > > >
> > > > HTH,
> > > > CJ
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > > > news:yG******** ************@ka roo.co.uk...
> > > > > Hey Group,
> > > > >
> > > > > Sorry but i`ve been searching everywhere for this even went out and
> > > bought
> > > > a
> > > > > ADO book and still carn`t find what im looking for:(
> > > > >
> > > > > I have the following code for my postion changed:
> > > > >
> > > > > Private Sub objdsAccess_Pos itionChanged()
> > > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
> > > > > Me.ComboBox1.Se lectedValue =
> > > > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > > > "Users").Positi on).Item("Acces sLevelID")
> > > > > End If
> > > > > Me.lblNavLocati on.Text =
(((Me.BindingCo ntext(objdsAcce ss, > > > > > "Users").Positi on + 1).ToString + " of ") +
> > > > Me.BindingConte xt(objdsAccess,
> > > > > "Users").Count. ToString)
> > > > > End Sub
> > > > >
> > > > > This works fine, with my Combo Box. My ComboBox is using the
> following
> > > > code:
> > > > >
> > > > > Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As

Object,
> > ByVal
> > > e
> > > > > As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
> > > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1
And
> Not
> > > > > mlLoading Then
> > > > >

objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess, > > > > > "Users").Positi on).Item("Acces sLevelID") =
> Me.ComboBox1.Se lectedValue
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > This all works fine, if im using Navigation buttons and

calling: > > > > > Me.objdsAccess_ PositionChanged ().
> > > > >
> > > > > However I`ve now added a Datagrid to my Form, as I select a

Row
in
> my
> > > > form.
> > > > > How would i get it to update my ComboBox, and notice the

position
> > > changed?
> > > > >
> > > > > Thanks
> > > > > MCN
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 20 '05 #9
Simon,

Alright, in your form load create a currency manager (using your
_cmDsAccess) with

_cmDsAccess = BindingContext( objdsAccess, "Users")

now you previously declared this as

private WithEvents _cmDsAccess as CurrencyManager

then you want to create a method such as

Private Sub _cmDsAccess_Pos itionChanged(By Val sender As Object, ByVal e As
System.EventArg s) Handles _cmDsAccess.Pos itionChanged

inisde this method is where you want to do

objdsAccess_Pos itionChanged()

try it out.

-CJ

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:fL******** ************@ka roo.co.uk...
From my Nav buttons I call objDsAccess_Pos titionChanged() for example:

Private Sub btnNavFirst_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnNavFirst.Cli ck
Me.BindingConte xt(objdsAccess, "Users").Positi on = 0
Me.objdsAccess_ PositionChanged ()
End Sub

My Datatable is bound to objdsAccess.Use rs.

I have a relationship Setup from my Users Table, AccessID row to my
AccessLevel Table AccessID.

My AccessLevelID Table has a AccessLevel Feild in it to which my ComboBox
Looks at.

Ta
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Killin me dog.

Alright, lets back it up a little bit. =)

1) objdsAccess_Pos itionChanged()

How is this called? what causes this to be called.?

2) Me.BindingConte xt(objdsAccess, "Users").

that right there is a currency manager. you can assign a variable to it,
makes things easier. Is your datagrid bound to this datatable on the
objDsAccess? what table is it bound to?

"MadCrazyNewbie " <te**@nospam.co m> wrote in message
news:u7******** ************@ka roo.co.uk...
Sorry CJ, I Must be going blind.

I think im going mad aswell and probably missing the point:(

How do i get it to do my positions changed? I have my Nav buttons setup
to call: Me.objDsAccess_ PositionChanged .

My Position Change code is as follows:

Private Sub objdsAccess_Pos itionChanged()
If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
Me.ComboBox1.Se lectedValue =
objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
"Users").Positi on).Item("Acces sLevelID")
End If
Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss,
"Users").Positi on + 1).ToString + " of ") + Me.BindingConte xt(objdsAccess, "Users").Count. ToString)
End Sub

How do i get this to work for my Datagrid. Do I need a:
Datagrid1_Selec tedIndexChanged . Sorry i don`t know where to call a datgird PostionChanged from or am I barking up the wrong tree?

Sorry to be a pain.

Cheers
MCN(Si)

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
> Go to your Code Window... Look at the combo box on the top left side.. you
> can't miss it.. there are two of them. right above your code. look
there.
> =)
>
>
>
>
> "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> news:iv******** ************@ka roo.co.uk...
> > CJ
> >
> > Im not to bad been really busy with work and wot not:( All work
and
no > > play:(
> >
> > Anyways ....... I`ve looked in my propery Browser but i carn`t
seem
to > find
> > cmDsAccess anywhere in there:(
> >
> > Any Ideas?
> >
> > Ta
> > MCN(Si)
> >
> > "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> > news:10******** *****@corp.supe rnews.com...
> > > Simon,
> > >
> > > since you declared your cmDsAccess WithEvents you can look up in the top
> > > left dropdown where it describes all you objects etc (like textboxes and
> > so
> > > on).
> > >
> > > in there you will see your cmDsAccess object. If you click on
it, > you'll
> > > see the events on the right side combo box. One of those will be > position
> > > changed.
> > >
> > > click it (subscribing to it) and then that is your notifcation that the
> > row
> > > position has changed within your datagrid. At that point, you can do
> > > whatever you want. for exmaple, on your position chaged event
you
can
> get
> > > the current row from the currency manager (cmDsAccess.Cur rent()) and > > > maniuplate your combo boxes based off that.
> > >
> > > How are things? Things are busy as sh**
> > >
> > > =)
> > >
> > > -CJ
> > >
> > > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > > news:Dc******** ************@ka roo.co.uk...
> > > > Hey CJ,
> > > >
> > > > Hows you doing?
> > > >
> > > > Right i`ve added Private WithEvents cmDsAccess As CurrencyManager
in
> my
> > > > Class Decleration and then added cmDsAccess =
> > BindingContext( objdsAccess,
> > > > "Users") in my form load.
> > > >
> > > > How would i now get it to change my bindings on my textboxs,
and Combo
> > box
> > > > as i select rows in my Datagrid?
> > > >
> > > > ManyThanks
> > > > MCN(Si)
> > > >
> > > > By Datasource, do you mean the
> > > > "CJ Taylor" <no****@blowgoa ts.com> wrote in message
> > > > news:10******** *****@corp.supe rnews.com...
> > > > > If they are associated with the same currency manager it will do it
> > > > > automatically.
> > > > >
> > > > > However, the probably isn't the case. anyways, in ADO.NET
you have
> > > these
> > > > > things called CurrencyManager s that basically act kinda like

an old
> > > > > ADODB.Recordset (yes like many things in .NET). Anyways,
> > > CurrencyManager s
> > > > > are created from bindings (actually you get them from the
> > bindingContext
> > > > of
> > > > > the control).
> > > > >
> > > > > This CurrencyManager is automatically subscribed the the

datagrid
> > events
> > > > (or
> > > > > vise versa, either way, upon changing the position in a datagrid > (i.e
> > > > moving
> > > > > to a new row) the currency managers position is changed for you and
> an
> > > > event
> > > > > is fired.
> > > > >
> > > > > so the best way to handle this is.
> > > > >
> > > > > In your class delcaration do this...
> > > > >
> > > > > Private WithEvents _cmMyDataset as CurrencyManager
> > > > >
> > > > > Then in your form load (best place I think, you can do it others > like
> > in
> > > > > your constructor, but not really a big deal.
> > > > >
> > > > > _cmMyDataSet = BindingContext( myDataSource, "myDataTabl e")
> > > > >
> > > > > Obviously replace those with valid values for your dataset and > > > datatable.
> > > > >
> > > > > Then, in your property browser on the top left (the drop down) you
> can
> > > > find
> > > > > the variable _cmMyDataSet Variable and the events associated

with
it
> > on
> > > > the
> > > > > right.
> > > > >
> > > > > Subscribe to the PositionChanged event, and then you can do
whatever
> > you
> > > > > want. (i.e something with your combobox based on new row data). > > > > >
> > > > > CurrencyMangers are also INCREDIBLY useful when doing record
> > > manipulation,
> > > > > because you can actually turn off the binding using the
> > > .SuspendBinding ()
> > > > > and .ResumeBinding( ) methods, so if your working with large

lists
> > (i.e.
> > > > > filling a large dataset) you can use suspendbinding while
your > filling
> > > it
> > > > > (otherwise, every time an item is added it goes through the
process
> of
> > > > > repainting a control because of the ListChanged event on an
> > IListSource
> > > > > item.
> > > > >
> > > > > HTH,
> > > > > CJ
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "MadCrazyNewbie " <te**@nospam.co m> wrote in message
> > > > > news:yG******** ************@ka roo.co.uk...
> > > > > > Hey Group,
> > > > > >
> > > > > > Sorry but i`ve been searching everywhere for this even went
out
> and
> > > > bought
> > > > > a
> > > > > > ADO book and still carn`t find what im looking for:(
> > > > > >
> > > > > > I have the following code for my postion changed:
> > > > > >
> > > > > > Private Sub objdsAccess_Pos itionChanged()
> > > > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on <> -1 Then
> > > > > > Me.ComboBox1.Se lectedValue =
> > > > > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess,
> > > > > > "Users").Positi on).Item("Acces sLevelID")
> > > > > > End If
> > > > > > Me.lblNavLocati on.Text = (((Me.BindingCo ntext(objdsAcce ss, > > > > > > "Users").Positi on + 1).ToString + " of ") +
> > > > > Me.BindingConte xt(objdsAccess,
> > > > > > "Users").Count. ToString)
> > > > > > End Sub
> > > > > >
> > > > > > This works fine, with my Combo Box. My ComboBox is using
the > > following
> > > > > code:
> > > > > >
> > > > > > Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As
Object,
> > > ByVal
> > > > e
> > > > > > As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged > > > > > > If Me.BindingConte xt(objdsAccess, "Users").Positi on

<> -1 And
> > Not
> > > > > > mlLoading Then
> > > > > > objdsAccess.Use rs.Rows(Me.Bind ingContext(objd sAccess, > > > > > > "Users").Positi on).Item("Acces sLevelID") =
> > Me.ComboBox1.Se lectedValue
> > > > > > End If
> > > > > > End Sub
> > > > > >
> > > > > > This all works fine, if im using Navigation buttons and

calling:
> > > > > > Me.objdsAccess_ PositionChanged ().
> > > > > >
> > > > > > However I`ve now added a Datagrid to my Form, as I select

a Row
in
> > my
> > > > > form.
> > > > > > How would i get it to update my ComboBox, and notice the
position
> > > > changed?
> > > > > >
> > > > > > Thanks
> > > > > > MCN
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1762
by: Nakor | last post by:
Hello, I am a Computer Programmer Analyst student. I am taking this course which for this week's assignment requires me to join some newsgroups. I am sorry to have to spam you with such useless crap. Regardless I am supposed to instigate a response of some sort, so could someone please fulfill that requirement for me? Thanks,
0
1444
by: Marco Herrn | last post by:
Hi, I tried to install a package under debian, where in the postinstall phase some python scripts are called. Then I got the error "Sorry invalid mode: U". I looked what this script does and it is the following: python -O /usr/lib/python2.3/compileall.py /usr/share/woody I looked where exactly in compileall.py the error occurs and it is here:
8
1757
by: Ivan Paganini | last post by:
Sorry, and thanks for the help. I will be more carefull in the next time. Ivan S>P<M
354
15928
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets hooked up to interfaces. The Gtk is more than enough gui.
5
1886
by: Nitin Bhardwaj | last post by:
Sorry I made a typo in the code The correct one is like this : #include <stdio.h> int main(void) { int *buf1 = malloc(10*sizeof(int)); int *buf2 = malloc(10*sizeof(int)); printf(buf1 > buf2 ? "Downwards" : "Upwards");
3
1239
by: Wizard | last post by:
Hi All, Sorry for been a pain in the ass, but im looking everywhere and can't seem to find the answers. I would like to build a small ASP based site. I have 4 departments, and what i would like to do is have a list of usernames and password. I would like the department heads to have a logon and be able to see only there departments usernames and password when they logon.
0
943
by: Carlo, MCP | last post by:
Sorry for the Italian previous message. It was a sending mistake. Sorry again. C.
8
3463
by: anand.1783 | last post by:
Dear moderator, Sorry for the inconvinience. So I am really sorry for the mistake. It happend by mistake and it will not be repeated. so kindly consider my Apology. Anand.
1
1327
by: maya | last post by:
I have a quick HomeSite question.. sorry, my news server doesn't carry HomeSite ng... I just need to know how to switch from generating special chars (called "entities" in XML) with numbers instead of their names -- need to do this b/c for XSLT/FF only numbers work.. I've been looking for a while now under "options", can't find it.. thank you very much..
7
1463
by: JamesCX DiPietro | last post by:
I just wanted to apologize again to Mr. Stuckle and Mr. Fesser for my awful and despicable behavior. THey were right all along and I behaved like a total shithead. I'm sorry, and I will never try to bother you again in this ng. Jerry Stuckle and Mike Fesser are both extremely helpful and brilliant individuals who volunteer here to answer technical questions. They don't have to do that, but they are willing to share their insight with...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9995
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.