Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
good day to all the programmers out there especially me. heheheheh


I just wanna ask something and also a little code if you don't mind.

For example i have a datagridview and a button in vb.net

and this are the contents.

|Number|
--------
|1 |
|2 |
|3 |
|4 |
|5 |
|6 |
--------

assuming that i have only 1 column in datagridview, i want to happen that when i click the button all the records from the said column will be increment by 1.

|Number|
--------
|2 |
|3 |
|4 |
|5 |
|6 |
|7 |
--------

calculation may do so if im right. i mean all the columns i doesnt mean if i have many records on the said column if it is 1000+ as long as all of them will increment by 1.

and after the calculation happens the output will be save on the same row. updated way.


ty in advance
Posted
Comments
Thanks7872 8-Aug-13 0:15am    
You should increment the underlying data from where you got it. Because DataGridView is used just to display data,it doesn't hold anything more than that.Which database have you used?
Crixalis Paul 8-Aug-13 0:21am    
As of know I am using Microsoft Access Database but after I finished my Project the database that I am using will be changed to Microsoft SQL.
Thanks7872 8-Aug-13 0:38am    
If you do your coding related to access and than you convert it to SQL ,then it wont be useful for you as two are totally different.
Crixalis Paul 8-Aug-13 0:43am    
Can you give me a tip or any substitute at my question?

1 solution

You can do this easily enough. I assume your grid is bound to some dataset. If not, it's just values in the grid, so you can still do it. On your button click handler, walk each row of your datasource (or grid) and increment the value in your Number column. When you're done, rebind, and the new values are displayed. Access, SQLServer or Oracle ... it's just a datasource, so that doesn't matter for what happens in the UI. If you need a code example, post the code of how you're populating your grid now.
 
Share this answer
 

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