473,657 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unexpected results from BindingSource.R esetCurrentItem ()

Hi folks

Calling BindingSource.R esetCurrentItem () is changing the
BindingSource.P osition in a way I don't understand.

If I'm understanding the docs correctly, ResetCurrentIte m()
should simply trigger an event which causes controls to
refresh with the values of the current item with the index
BindingSource.P osition. This is not what I'm seeing.

I'm trying to copy values from the current item to a new
item. In the code below, there are 400 items in the
underlying data (a strongly typed DataTable), and I'm trying
to copy the 100th item.
>>>>>>>>>>> >>>>>>>>>>>>> >> if( editAction == EditAction.Copy )
{
// bindingSource.P osition == 99 as expected

DataRowView fromRow = (DataRowView)bi ndingSource.Cur rent;

string label =
fromRow["label"].ToString().Clo ne().ToString() ;

bindingSource.A ddNew();

// bindingSource.P osition == 400 as expected

DataRowView toRow = (DataRowView)bi ndingSource.Cur rent;
toRow["label"] = label;

// Reset to update the control

bindingSource.R esetCurrentItem ();

// bindingSource.P osition == 97, expected it to be 400
}
>>>>>>>> >>>>>>>>>>>>> >>


I don't understand why the Position is jumping to what seems
to be an arbitrary value.

I'm a C# newbie, so please forgive any basic errors. I'm at
a bit of a loss with this one, so any pointers would be much
appreciated.
Feb 21 '06 #1
0 4148

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

Similar topics

3
3917
by: silesius | last post by:
Hi All, I have two pagetabs. One pagetab is used to display a parent record and the other is suppose to display 3 related child records from another table. I can display the parent records just fine by using the bindingSource and a tableAdapter to fill the dataset. I'm having a problem displaying the 3 related records on the other pagetab. I can only bind to one record and have the bindingsource populate one set of databound contorls. I...
1
4531
by: TN | last post by:
I just don't get the BindingSource class when it is bound to a class. Consider this code snip: ..... Private bSource As New BindingSource() Private dgv As New DataGridView() Public Sub New() InitializeComponent()
4
18704
by: shibeta | last post by:
Hello, I have problem with DataGridView and BindingSource. I have created DataSet and added TableData to it with manualy created columns (without DataAdapter - I'm not using MSSQL). On the Form I put DataGridView and BindingSource, and connected them (BindingSource of course is also connected with DataSet). Next on the separated thread I'm reading data from DB and load them do DataSet (more preciselly, readed data I've saved as XML and...
6
14973
by: BD | last post by:
Hi, I have a "Cancel" button on a form to cancel any changes in the current item with the code BindingSource1.CancelEdit but this don't restore the older's values that had been changed. The BindingSource.DataSource is a type of BindingList<MyClass>. What's I'm doing wrong? 's BD
7
13444
by: Mike | last post by:
i have a small difficulties with BindingSource and dataGridView bind db has properly opened and bind doesn't works. Unfortunately I didn't find any good example how to connect MS Access with dataGridView and BindSource class. Maybe something like this: DataTable dtResult = new DataTable(); dtResult = GetData(); // this line returns a error GetData doesn't exists!
13
3597
by: bintom | last post by:
I ran the following simple code in C++ and got unexpected results: float f = 139.4; cout << f; Output: 139.399994;
2
4503
by: jehugaleahsa | last post by:
Hello: I'm working on improving some of our Windows Forms. I have created two user controls that I want to bind to the same BindingSource. I have an overview control that is used just to identify a customer. Then there is a details view that shows all their specifics. I wanted to keep navigation outside of my view. There is also a
5
4931
by: jehugaleahsa | last post by:
Hello: I am sure this question comes up a lot. I need to disable the controls on my Windows forms so that when the BindingSource is empty some the controls bound to it will be disabled. This will make it clear to the user that they have to create a new item first before they start working. This needs to be an easy process because there are many, many forms.
2
4659
by: TamusJRoyce | last post by:
I am working on a group project where I do not have access to a BindingSource that is being passed through a function. The BindingSource's DataSource is set to a custom IBindingListView Collection. When I try to set IsNew on the BindingSource having the custom IBindingListView, the BindingSource IsNew remaines false. I have been able to do a test with my own IBindingListView being set on the BindingSource, and if I set IsNew before I set...
0
8392
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
8305
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
8732
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
8605
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
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2726
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
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1611
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.