473,387 Members | 1,705 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,387 software developers and data experts.

How To add value to datagridview cell in runtime

4
Hi there
this is my scenario
i have created one dataGridView control in my form. It already bounded with Customers table in database.
Please follow the picture that i have uploaded;
the pino column should contain Invoice NO textbox's text
for every new row until user click Generate Invoice button.
iam using dataGridView control for inserting the values to database customers
so how do i add value for every pino field in run time
any help regarding to this will be appreciated
Attached Images
File Type: jpg prox.jpg (21.7 KB, 1537 views)
Dec 17 '11 #1

✓ answered by adriancs

Expand|Select|Wrap|Line Numbers
  1. int n = dataGridView1.Rows.Add();
  2. dataGridView1.Rows[n].Cells[0].Value = "A001-001";
  3. dataGridView1.Rows[n].Cells[1].Value = "This is the first Invoice";
  4. dataGridView1.Rows[n].Cells[2].Value = "Something about the Invoice";
  5. dataGridView1.Rows[n].Cells[3].Value = 55;
  6. dataGridView1.Rows[n].Cells[4].Value = 98.30;
  7. dataGridView1.Rows[n].Cells[5].Value = (decimal)dataGridView1.Rows[n].Cells[3].Value * (decimal)dataGridView1.Rows[n].Cells[4].Value;

2 45124
adriancs
122 100+
Expand|Select|Wrap|Line Numbers
  1. int n = dataGridView1.Rows.Add();
  2. dataGridView1.Rows[n].Cells[0].Value = "A001-001";
  3. dataGridView1.Rows[n].Cells[1].Value = "This is the first Invoice";
  4. dataGridView1.Rows[n].Cells[2].Value = "Something about the Invoice";
  5. dataGridView1.Rows[n].Cells[3].Value = 55;
  6. dataGridView1.Rows[n].Cells[4].Value = 98.30;
  7. dataGridView1.Rows[n].Cells[5].Value = (decimal)dataGridView1.Rows[n].Cells[3].Value * (decimal)dataGridView1.Rows[n].Cells[4].Value;
Dec 17 '11 #2
kisho
4
Thank you so much adriancs......
keep up the good work
Dec 17 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steve | last post by:
I am looking for an example of a custom user control ( 2 labels and 2 datetime pickers ) in a datagridview cell. Every example I have come across handles only once control such as a datetimepicker...
3
by: nagen | last post by:
I have an existing excel file & i would like to enter a specific value at cell A1 in Excel2003 using asp.net 2.0 how can i do this?
11
by: dgk | last post by:
Is there a way to change the foreground or background color of a single cell in an unbound datagridview?
3
by: Rich | last post by:
Hello, If I want to update data displayed in a datagrideview/datagridview cell, how can I determine what cell I am updating? I am looking at the click event below, for example. Can I get...
1
by: jr1024 | last post by:
How do I get the value of dataGridView? I have the rowIndex and the columnIndex.
2
by: AnujaManudhane | last post by:
How to the value of cell on datagrid
0
by: varunk2 | last post by:
Hi How to autocomplete a datagridview cell in c# windows forms. Please anybody help me... Thanks in advance Regards,
8
by: kashifabbasi786 | last post by:
I want to change the DataGridView Heading on run time by giving in textbox. how i will do this,plz help me Thnx
0
by: hydro123 | last post by:
I am using VC++2008 and am trying to read data enetered in unbound datagridview to implement in function. Under button_click event I entered the following: // initialize varaibles from...
0
by: ziketo | last post by:
Hi, I searched a lot about changing the DataGridView cell borders. BYTES helped me so I will write down the solution: 1. You should override the class DataGridViewTextBoxCell, and the new class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...

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.