Click here to Skip to main content
15,920,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys.I have a problem.Let's explain this:
I create a DataTable 'DataT' variable and added row to this variable.SameTime i have datagridview.After i assingmented 'DataT' to DataSource property of DataGridView.
I get 'DataT' Rows.Count property.It's value 10.But this value decrease from 10 to 5 when i removed 5 Rows of DataGridView.
So why decrease my value i just remove Rows of DataGridView but i did not remove rows of 'DataT' although rows count of 'DataT' decrease from 10 to 5.
I have not solve this problem.

I have wait to your help.
I thank you.....

What I have tried:

I research and coding and so mnay algorithm.But those don't solve that problem.
Posted
Updated 14-Jan-17 4:14am

1 solution

When you use DataSource, the data is bound to the DataGridView.
Here is an excellent article explaining data binding:
A Detailed Data Binding Tutorial[^]
 
Share this answer
 
Comments
Member 11152823 14-Jan-17 11:39am    
I thank you for comment.But i to met other state.For example i used byte array and this byte array assigment to other byte array.I change values of Second byte array then first byte array change values.So both change values of variables when i just change one variable value.As if 2 variable bind to each other.
How do i prevent this case.?
I thank you...
RickZeeland 14-Jan-17 13:07pm    
When you use Array2 = Array1; you do not get a copy, but a pointer to Array1 instead.
Use the Array.CopyTo() method to create a new array.
See: https://msdn.microsoft.com/en-us/library/06x742cw(v=vs.110).aspx
Member 11152823 14-Jan-17 13:28pm    
Thanks RickZeeland.
I used that method "CopyTo()".But all the same forced each other.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900