473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

CurrencyManager Relations

I have a CM bound to a table like this:
cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
"SortOrder"];
Under certain circumstances I need to find a specific row in that table
DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
When that happens, I need the CM.Position to reflect that row so that
everything stays in sync. How can I ensure that this happens?
Nov 17 '05 #1
5 1480
Christopher,

Once you find the row, you will have to set the Position property on the
CurrencyManager instance to reflect the position in the list that the row is
at. Once you do this, everything will be in sync.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I have a CM bound to a table like this:
cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
"SortOrder"];
Under certain circumstances I need to find a specific row in that table
DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
When that happens, I need the CM.Position to reflect that row so that
everything stays in sync. How can I ensure that this happens?

Nov 17 '05 #2
Exactly, but how do I do it! The problem boils down to my not knowing how
to find the position of the row in the list.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
Christopher,

Once you find the row, you will have to set the Position property on
the CurrencyManager instance to reflect the position in the list that the
row is at. Once you do this, everything will be in sync.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I have a CM bound to a table like this:
cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
"SortOrder"];
Under certain circumstances I need to find a specific row in that table
DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
When that happens, I need the CM.Position to reflect that row so that
everything stays in sync. How can I ensure that this happens?


Nov 17 '05 #3
Christoper,

That requires some specific knowledge of the data you are looking at
(which I am sure you have). Basically, you have to take the field values
which make the row unique (usually, a primary key), and search for it in
your sorted data list.

If you are looking at a DataTable, or a DataView, you can use the
indexer, from 0 to Count - 1 to cycle through the rows and determine if the
row matches your found row. If your data source is sorted by this key, then
you could even do a binary search to find the index of the row.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:Op**************@TK2MSFTNGP10.phx.gbl...
Exactly, but how do I do it! The problem boils down to my not knowing how
to find the position of the row in the list.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Christopher,

Once you find the row, you will have to set the Position property on
the CurrencyManager instance to reflect the position in the list that the
row is at. Once you do this, everything will be in sync.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I have a CM bound to a table like this:
cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
"SortOrder"];
Under certain circumstances I need to find a specific row in that table
DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
When that happens, I need the CM.Position to reflect that row so that
everything stays in sync. How can I ensure that this happens?



Nov 17 '05 #4
"cycle through the rows "

So I take it there is no property or function that will return the "IndexOf"
for a given primary key field value. But I guess I could write a genic one,
something like int FindKey(int KeyValue, DataTable.Rows r){}. Fortunately,
in this particular case, there are relatively few rows of data in this
DataTable.

Thanks for your help.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ex**************@tk2msftngp13.phx.gbl...
Christoper,

That requires some specific knowledge of the data you are looking at
(which I am sure you have). Basically, you have to take the field values
which make the row unique (usually, a primary key), and search for it in
your sorted data list.

If you are looking at a DataTable, or a DataView, you can use the
indexer, from 0 to Count - 1 to cycle through the rows and determine if
the row matches your found row. If your data source is sorted by this
key, then you could even do a binary search to find the index of the row.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:Op**************@TK2MSFTNGP10.phx.gbl...
Exactly, but how do I do it! The problem boils down to my not knowing
how to find the position of the row in the list.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Christopher,

Once you find the row, you will have to set the Position property on
the CurrencyManager instance to reflect the position in the list that
the row is at. Once you do this, everything will be in sync.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I have a CM bound to a table like this:
cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
"SortOrder"];
Under certain circumstances I need to find a specific row in that table
DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
When that happens, I need the CM.Position to reflect that row so that
everything stays in sync. How can I ensure that this happens?



Nov 17 '05 #5
Oooops!

Should have been
int FindKey(int Key, System.Data.DataRowCollection r)
"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
"cycle through the rows "

So I take it there is no property or function that will return the
"IndexOf" for a given primary key field value. But I guess I could write
a genic one, something like int FindKey(int KeyValue, DataTable.Rows r){}.
Fortunately, in this particular case, there are relatively few rows of
data in this DataTable.

Thanks for your help.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:ex**************@tk2msftngp13.phx.gbl...
Christoper,

That requires some specific knowledge of the data you are looking at
(which I am sure you have). Basically, you have to take the field values
which make the row unique (usually, a primary key), and search for it in
your sorted data list.

If you are looking at a DataTable, or a DataView, you can use the
indexer, from 0 to Count - 1 to cycle through the rows and determine if
the row matches your found row. If your data source is sorted by this
key, then you could even do a binary search to find the index of the row.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:Op**************@TK2MSFTNGP10.phx.gbl...
Exactly, but how do I do it! The problem boils down to my not knowing
how to find the position of the row in the list.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Christopher,

Once you find the row, you will have to set the Position property on
the CurrencyManager instance to reflect the position in the list that
the row is at. Once you do this, everything will be in sync.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Christopher Weaver" <we*****@nospamverizon.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
>I have a CM bound to a table like this:
> cMgrSort = (CurrencyManager)this.BindingContext[dsSortOrders,
> "SortOrder"];
> Under certain circumstances I need to find a specific row in that
> table
> DataRow r = dsSortOrders.Tables["SortOrder"].Rows.Find(SortOrder);
> When that happens, I need the CM.Position to reflect that row so that
> everything stays in sync. How can I ensure that this happens?
>



Nov 17 '05 #6

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

Similar topics

1
by: Pete Davis | last post by:
I have written a custom databound grid control that we've been using successfully for months, but one of our developers has just run into a problem that I can't figure out. The code for setting...
4
by: Kris Bethea via DotNetMonster.com | last post by:
Greetings, I have a VB.NET program that I am trying to convert to C# (my office decided that we are going to use C# from now on). I've only been working with C# for about a month now, so this...
2
by: web1110 | last post by:
I created a class derived from a DataGridTextBoxColumn. I have it working through looking at various examples on the net. To update the underlying DataGrid, I had to overload the Edit method...
10
by: D | last post by:
hi I have a form with 2 datagrids showing related table data in a master / child or order / order details type relationship. I would like to auto select the row in the order details table which...
4
by: Jeremy | last post by:
I have a dataset containing 2 tables. A is the master table, B is a lookup table. There is a combobox bound to B, which updates a value in a FK field in A. my currencymanager is created thus:...
2
by: Rich | last post by:
Hello, I have a datagrid (dgr1) on a form and I'm trying to bind a currencyManager Object (cma) to it and print the current row position. But all I get for cma.Position is 0, 0, 0 for any row...
3
by: Brian Richardson | last post by:
Hi, Please can anyone kindly offer some suggestions as to why the CurrencyManager might not refresh. I am using the CurrencyManager to navigate through a DataView. I am aware that there is...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
0
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.