473,473 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Resetting values in DataGrid

On form load my datagrid gets populated with values from database table. How
can I reset values in my DataGrid to 0 on click of a button?
thanks
Jul 21 '05 #1
4 1467
If I understand you correctly, you can call the .Clear method of the
datatable object its bound to. that will eliminate all of the rows and the
grid will be empty. Is this what you meant?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
On form load my datagrid gets populated with values from database table. How can I reset values in my DataGrid to 0 on click of a button?
thanks

Jul 21 '05 #2
Hi Ryan

Actually i don't want my DataGrid to get empty. I want to reset the value in
the cells (or values held in the datatable) to 0 (Zero). On click on button
it should change all the values to 0.

"W.G. Ryan eMVP" wrote:
If I understand you correctly, you can call the .Clear method of the
datatable object its bound to. that will eliminate all of the rows and the
grid will be empty. Is this what you meant?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
On form load my datagrid gets populated with values from database table.

How
can I reset values in my DataGrid to 0 on click of a button?
thanks


Jul 21 '05 #3
Job,

You never can set a value in a datagrid (windowforms) to zero when the
underlaying datasource has another value than zero.

So when you want what you ask you have to set that field to zero. You can
reset a datarow by the original state (last filled) with
datarow.rejectchanges

I hope this helps?

Cor

"Job Lot" <Jo****@discussions.microsoft.com>

Actually i don't want my DataGrid to get empty. I want to reset the value in the cells (or values held in the datatable) to 0 (Zero). On click on button it should change all the values to 0.

"W.G. Ryan eMVP" wrote:
If I understand you correctly, you can call the .Clear method of the
datatable object its bound to. that will eliminate all of the rows and the grid will be empty. Is this what you meant?
"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
On form load my datagrid gets populated with values from database
table. How
can I reset values in my DataGrid to 0 on click of a button?
thanks


Jul 21 '05 #4
br............

The rejectchanges reset untill the last acceptchanges to be more clear.

Cor
Jul 21 '05 #5

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

Similar topics

1
by: Derek | last post by:
Another DGrid question... I can not access the values of a cell in a datagrid unless I make them visible. I do not want these fields displayed. I only want to use the values to run a stored...
0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
3
by: VM | last post by:
How can I reset a datagrid? In my code, on an event, I do all the databinding of the datagrid to the dataset dynamically: .... //get the Dataset DGOrders.SetDataBinding(DSMyTrans,...
2
by: Balamurukan | last post by:
How to retrive property values from our own property window
1
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
4
by: Vik | last post by:
How can I display the lookup values in a datagrid? E.g., the datagrid displays a table that contains a ProductID field. I want to display a Product description from a Product table in that...
1
by: Sam | last post by:
Hi, I'm trying to clear my datagrid. For this I was thinking about reseting my its datasource (dataset) to nothing and then refreshing the datagrid using refresh. Is that the correct method, if so...
4
by: Job Lot | last post by:
On form load my datagrid gets populated with values from database table. How can I reset values in my DataGrid to 0 on click of a button? thanks
4
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
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...
1
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.