473,407 Members | 2,676 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,407 software developers and data experts.

BindingManagerBase.Position and Table.Rows.Find

How do I retrieve the position value after successfully finding the row that
I'm looking for? I need to set

BindingManagerBase.Position

so that all of the controls on the form are synchronized. Is there another
way of moving to a particular record within a dataset given the value of the
key?

Nov 17 '05 #1
4 6225
Christopher,

Because this is a base class is this not the way to go.

Have a look at this page, there is a lot of explanation too.
Currencymanager

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Nov 17 '05 #2
Hi Christopher,

As you use complex data binding, do the following:

CurrencyManager cm = (CurrencyManager)this.BindingContext[theDataTable];
DataView dv = (DataView)cm.List;

// Search the row in the DataView by its key.
// We need the index of the row in the DataView, not the source DataTable.

cm.Position = foundRowIndex;

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Christopher Weaver" <we*****@verizon.net> wrote in message
news:OQ**************@TK2MSFTNGP09.phx.gbl...
How do I retrieve the position value after successfully finding the row
that I'm looking for? I need to set

BindingManagerBase.Position

so that all of the controls on the form are synchronized. Is there
another way of moving to a particular record within a dataset given the
value of the key?


Nov 17 '05 #3
Here's what I've tried so far:

The declaration in the form's class definition:
private CurrencyManager ByNames_cMgr;

In the form constructor:
ByNames_cMgr = (CurrencyManager)this.BindingContext[dsAssignedBy1,
"Table"];

In the DropDown event handler for the ComboBox:

ComboBox cb = (ComboBox)sender;
DataTable dt = (DataTable)cb.DataSource;
string cbText = cb.Text;
int rowIndex;
try
{
try
{
Cursor.Current = Cursors.WaitCursor;
odbcDA_Names.Fill(dt);
DataView dv = new DataView(dt);
dv.Sort = "Name";
rowIndex = dv.Find(cbText);
MessageBox.Show(rowIndex.ToString());
ByNames_cMgr.Position = rowIndex;

etc....

The MessageBox.Show call confirms that I've actually found the index of the
row that I'm looking for, but the Position assignment doesn't move the
pointer within the ComboBox dropdown list to that record.

Any help you can give will be greatly appreciated.
Nov 17 '05 #4
Please have look at my reply to Dmytro's post.

Thanks for your help!
Nov 17 '05 #5

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

Similar topics

1
by: Rowan | last post by:
Hi there, it has been a while since i have posted. I am in a situation where I am stumped. I am learning to build a dts package where I am connecting to a table in an AS400. This database is...
1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
14
by: Zenobia | last post by:
Hello folks, Is it possible to position an item within a <td> element? For instance see below. The table has multiple rows, one for each database record. Each row has 3 hrefs associated with it...
0
by: Frnak McKenney | last post by:
I have a (small) multi-table database application which allows edits, print reports, and has two scrolling screen displays which show information merged from multiple tables. I'm having trouble...
4
by: Joe | last post by:
can someone help me with this code (1) daNewEmployer.Fill(DsNewEmployer) (2) daNewEmployee.Fill(DsNewEmployer) (3)bmbEmployer = BindingContext(DsNewEmployer, "Employer") I am trying to fill a...
4
by: Jesse Villani | last post by:
I will get this eventually, I have a combobox on a form which is bound to a dataset and displays correct values in the list. When i select a value from the list, i check to see what is the...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
1
by: dbuchanan52 | last post by:
My newly added row will not become current. I have several textboxes bound to a DataGrid1 and a couple of buttons including 'btnNewRecord'. The datagrid is bound to a table in a dataset. What...
2
by: Sam Malone | last post by:
I have these four methods to change the position in a table. However when I invoke any of them nothing appears to happen to the table. It doesn't scroll. The selector pointer doesn't move. Nada!! If...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.