PC Review


Reply
Thread Tools Rate Thread

Direct navigation to specific rows in a DataSource...

 
 
Rafael Soteldo
Guest
Posts: n/a
 
      23rd Apr 2008
Hi there:

I need to get the position of a given Row to navigate directly to it, in a
form that has a BindingNavigator and several TextBoxes showing each rows
details...

I dragged the fields from the Data Sources window to the form in the
designer, which created the BindingNavigator attached to a BindingSource.

As far as I know, the BindingSource lets you move to the first, next, to a
position, previous and last row of a DataTable, so, what if I need to
navigate directly to a row that has a specific value in a field (for
instance, "Carl" in the field "Name" in the DataTable "People"). I suppose I
should get the row position within the DataTable attached to the
BindingSource, and then set the BindingSource.Position to that position.

But how ca I do that?, the DataTable doesn't expose a property that shows
the relative position of each row in the table.

Moreover, what if the DataSource is a DataView with filters set, how do I
get the position of that given row within this DataView?

Please, need help...

Thanks in advance...,

Rafael Soteldo
 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      24th Apr 2008

Rafael,

You are using so many techniques over each other that I don't know how to
answer this. However this class manages your positions in a table.

http://msdn2.microsoft.com/en-us/lib...cymanager.aspx

(It has nothing to do with currencies in the way of money as sometimes is
thought)

Cor

"Rafael Soteldo" <(E-Mail Removed)> schreef in
bericht news:920F4FCF-ECB4-46C3-9F1D-(E-Mail Removed)...
> Hi there:
>
> I need to get the position of a given Row to navigate directly to it, in a
> form that has a BindingNavigator and several TextBoxes showing each rows
> details...
>
> I dragged the fields from the Data Sources window to the form in the
> designer, which created the BindingNavigator attached to a BindingSource.
>
> As far as I know, the BindingSource lets you move to the first, next, to a
> position, previous and last row of a DataTable, so, what if I need to
> navigate directly to a row that has a specific value in a field (for
> instance, "Carl" in the field "Name" in the DataTable "People"). I suppose
> I
> should get the row position within the DataTable attached to the
> BindingSource, and then set the BindingSource.Position to that position.
>
> But how ca I do that?, the DataTable doesn't expose a property that shows
> the relative position of each row in the table.
>
> Moreover, what if the DataSource is a DataView with filters set, how do I
> get the position of that given row within this DataView?
>
> Please, need help...
>
> Thanks in advance...,
>
> Rafael Soteldo


 
Reply With Quote
 
Rafael Soteldo
Guest
Posts: n/a
 
      24th Apr 2008
Thanks for answering!

I'll study it...
--

Rafael Soteldo


"Cor Ligthert[MVP]" wrote:

>
> Rafael,
>
> You are using so many techniques over each other that I don't know how to
> answer this. However this class manages your positions in a table.
>
> http://msdn2.microsoft.com/en-us/lib...cymanager.aspx
>
> (It has nothing to do with currencies in the way of money as sometimes is
> thought)
>
> Cor
>
> "Rafael Soteldo" <(E-Mail Removed)> schreef in
> bericht news:920F4FCF-ECB4-46C3-9F1D-(E-Mail Removed)...
> > Hi there:
> >
> > I need to get the position of a given Row to navigate directly to it, in a
> > form that has a BindingNavigator and several TextBoxes showing each rows
> > details...
> >
> > I dragged the fields from the Data Sources window to the form in the
> > designer, which created the BindingNavigator attached to a BindingSource.
> >
> > As far as I know, the BindingSource lets you move to the first, next, to a
> > position, previous and last row of a DataTable, so, what if I need to
> > navigate directly to a row that has a specific value in a field (for
> > instance, "Carl" in the field "Name" in the DataTable "People"). I suppose
> > I
> > should get the row position within the DataTable attached to the
> > BindingSource, and then set the BindingSource.Position to that position.
> >
> > But how ca I do that?, the DataTable doesn't expose a property that shows
> > the relative position of each row in the table.
> >
> > Moreover, what if the DataSource is a DataView with filters set, how do I
> > get the position of that given row within this DataView?
> >
> > Please, need help...
> >
> > Thanks in advance...,
> >
> > Rafael Soteldo

>
>

 
Reply With Quote
 
Rafael Soteldo
Guest
Posts: n/a
 
      25th Apr 2008
Hi Cor:

The CurrencyManager holds the position of the current row in the
BindingSource, but I want to navigate directly to a specific row whose
relative position in the DataTable is unknown. The DataTable doesn't expose a
CurrencyManager.

I guess there must be another way...
--

Rafael Soteldo


"Cor Ligthert[MVP]" wrote:

>
> Rafael,
>
> You are using so many techniques over each other that I don't know how to
> answer this. However this class manages your positions in a table.
>
> http://msdn2.microsoft.com/en-us/lib...cymanager.aspx
>
> (It has nothing to do with currencies in the way of money as sometimes is
> thought)
>
> Cor
>
> "Rafael Soteldo" <(E-Mail Removed)> schreef in
> bericht news:920F4FCF-ECB4-46C3-9F1D-(E-Mail Removed)...
> > Hi there:
> >
> > I need to get the position of a given Row to navigate directly to it, in a
> > form that has a BindingNavigator and several TextBoxes showing each rows
> > details...
> >
> > I dragged the fields from the Data Sources window to the form in the
> > designer, which created the BindingNavigator attached to a BindingSource.
> >
> > As far as I know, the BindingSource lets you move to the first, next, to a
> > position, previous and last row of a DataTable, so, what if I need to
> > navigate directly to a row that has a specific value in a field (for
> > instance, "Carl" in the field "Name" in the DataTable "People"). I suppose
> > I
> > should get the row position within the DataTable attached to the
> > BindingSource, and then set the BindingSource.Position to that position.
> >
> > But how ca I do that?, the DataTable doesn't expose a property that shows
> > the relative position of each row in the table.
> >
> > Moreover, what if the DataSource is a DataView with filters set, how do I
> > get the position of that given row within this DataView?
> >
> > Please, need help...
> >
> > Thanks in advance...,
> >
> > Rafael Soteldo

>
>

 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      25th Apr 2008
Rafael,

The currencymanager exist much longer than the bindingsource, it is there as
long as there is Net.

Two samples.
http://www.vb-tips.com/DataGridRowChange.aspx

http://www.vb-tips.com/DataGridRowCount.aspx

Cor

"Rafael Soteldo" <(E-Mail Removed)> schreef in
bericht news:18C731C5-F481-437D-A342-(E-Mail Removed)...
> Hi Cor:
>
> The CurrencyManager holds the position of the current row in the
> BindingSource, but I want to navigate directly to a specific row whose
> relative position in the DataTable is unknown. The DataTable doesn't
> expose a
> CurrencyManager.
>
> I guess there must be another way...
> --
>
> Rafael Soteldo
>
>
> "Cor Ligthert[MVP]" wrote:
>
>>
>> Rafael,
>>
>> You are using so many techniques over each other that I don't know how to
>> answer this. However this class manages your positions in a table.
>>
>> http://msdn2.microsoft.com/en-us/lib...cymanager.aspx
>>
>> (It has nothing to do with currencies in the way of money as sometimes is
>> thought)
>>
>> Cor
>>
>> "Rafael Soteldo" <(E-Mail Removed)> schreef in
>> bericht news:920F4FCF-ECB4-46C3-9F1D-(E-Mail Removed)...
>> > Hi there:
>> >
>> > I need to get the position of a given Row to navigate directly to it,
>> > in a
>> > form that has a BindingNavigator and several TextBoxes showing each
>> > rows
>> > details...
>> >
>> > I dragged the fields from the Data Sources window to the form in the
>> > designer, which created the BindingNavigator attached to a
>> > BindingSource.
>> >
>> > As far as I know, the BindingSource lets you move to the first, next,
>> > to a
>> > position, previous and last row of a DataTable, so, what if I need to
>> > navigate directly to a row that has a specific value in a field (for
>> > instance, "Carl" in the field "Name" in the DataTable "People"). I
>> > suppose
>> > I
>> > should get the row position within the DataTable attached to the
>> > BindingSource, and then set the BindingSource.Position to that
>> > position.
>> >
>> > But how ca I do that?, the DataTable doesn't expose a property that
>> > shows
>> > the relative position of each row in the table.
>> >
>> > Moreover, what if the DataSource is a DataView with filters set, how do
>> > I
>> > get the position of that given row within this DataView?
>> >
>> > Please, need help...
>> >
>> > Thanks in advance...,
>> >
>> > Rafael Soteldo

>>
>>


 
Reply With Quote
 
Rafael Soteldo
Guest
Posts: n/a
 
      25th Apr 2008
I'll try it...

thanks
--

Rafael Soteldo


"Cor Ligthert[MVP]" wrote:

> Rafael,
>
> The currencymanager exist much longer than the bindingsource, it is there as
> long as there is Net.
>
> Two samples.
> http://www.vb-tips.com/DataGridRowChange.aspx
>
> http://www.vb-tips.com/DataGridRowCount.aspx
>
> Cor
>
> "Rafael Soteldo" <(E-Mail Removed)> schreef in
> bericht news:18C731C5-F481-437D-A342-(E-Mail Removed)...
> > Hi Cor:
> >
> > The CurrencyManager holds the position of the current row in the
> > BindingSource, but I want to navigate directly to a specific row whose
> > relative position in the DataTable is unknown. The DataTable doesn't
> > expose a
> > CurrencyManager.
> >
> > I guess there must be another way...
> > --
> >
> > Rafael Soteldo
> >
> >
> > "Cor Ligthert[MVP]" wrote:
> >
> >>
> >> Rafael,
> >>
> >> You are using so many techniques over each other that I don't know how to
> >> answer this. However this class manages your positions in a table.
> >>
> >> http://msdn2.microsoft.com/en-us/lib...cymanager.aspx
> >>
> >> (It has nothing to do with currencies in the way of money as sometimes is
> >> thought)
> >>
> >> Cor
> >>
> >> "Rafael Soteldo" <(E-Mail Removed)> schreef in
> >> bericht news:920F4FCF-ECB4-46C3-9F1D-(E-Mail Removed)...
> >> > Hi there:
> >> >
> >> > I need to get the position of a given Row to navigate directly to it,
> >> > in a
> >> > form that has a BindingNavigator and several TextBoxes showing each
> >> > rows
> >> > details...
> >> >
> >> > I dragged the fields from the Data Sources window to the form in the
> >> > designer, which created the BindingNavigator attached to a
> >> > BindingSource.
> >> >
> >> > As far as I know, the BindingSource lets you move to the first, next,
> >> > to a
> >> > position, previous and last row of a DataTable, so, what if I need to
> >> > navigate directly to a row that has a specific value in a field (for
> >> > instance, "Carl" in the field "Name" in the DataTable "People"). I
> >> > suppose
> >> > I
> >> > should get the row position within the DataTable attached to the
> >> > BindingSource, and then set the BindingSource.Position to that
> >> > position.
> >> >
> >> > But how ca I do that?, the DataTable doesn't expose a property that
> >> > shows
> >> > the relative position of each row in the table.
> >> >
> >> > Moreover, what if the DataSource is a DataView with filters set, how do
> >> > I
> >> > get the position of that given row within this DataView?
> >> >
> >> > Please, need help...
> >> >
> >> > Thanks in advance...,
> >> >
> >> > Rafael Soteldo
> >>
> >>

>
>

 
Reply With Quote
 
Hertha Steck
Guest
Posts: n/a
 
      26th Apr 2008
Rafael Soteldo schrieb:
> I'll try it...
>
> thanks


I'd use the "select" method of the DataTable connected to the
DataSource. All the details in the SDK documentation.

HTH
Hertha
 
Reply With Quote
 
Rafael Soteldo
Guest
Posts: n/a
 
      27th Apr 2008
Hi Hertha:

Whenever I use Select, it doesn't set the position of the BindingSources
attached to the DataTable.

The question is: How do I position a BindingSource (attached to a DataTable)
to a row which position in the DataTable is unknown.

Select returns a Row[], if the row I'm looking fo is unique, the array will
have only one row, but, what's it's relative position in the table?

The DataTable itself doen't have a CurrencyManager to help us know the
relative position of each row.

I still don't know what to do here...

Why am I asking this:

I dragged several fields from the DataSource window to my form. It created
several textboxes, a BindingNavigator and a BindingSource which will be the
intermidiate layer between the DataTable and the mentioned controls.

The only way a user has to look for a row in the DataTable with this
interface is to navigate through several rows until he (she) finds it.

I want to give the user the ability to also specify a field value (for
example "J Lo" in a DataTable People), to go directly to...
--

Rafael Soteldo


"Hertha Steck" wrote:

> Rafael Soteldo schrieb:
> > I'll try it...
> >
> > thanks

>
> I'd use the "select" method of the DataTable connected to the
> DataSource. All the details in the SDK documentation.
>
> HTH
> Hertha
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BindingSources, BindingNavigators and direct navigation... Rafael Soteldo Microsoft ADO .NET 5 29th Apr 2008 01:20 AM
Need direct navigation to a row in a BindingSource Rafael Soteldo Microsoft Dot NET 0 22nd Apr 2008 11:47 PM
How can I direct emails sent to specific addresses to specific fo. =?Utf-8?B?YmJsYW5jMDE=?= Microsoft Outlook Discussion 1 28th Oct 2006 11:17 AM
Possible to prevent direct navigation to a page? =?Utf-8?B?QmVu?= Microsoft C# .NET 3 26th May 2006 01:35 PM
Direct a specific report to a specific printer jon Microsoft Access Reports 1 28th Apr 2004 06:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 AM.