Windows Develop Bookmark and Share   
 index > Windows Forms Designer > how can i use logical expression
 

how can i use logical expression

hi,
im doing a project in vb.net using data grid. i want to know , how to subtract or add to values retrieved from data grid
xplorsoftware  Saturday, August 08, 2009 4:28 AM
Hi,

For e.g your data GridView Cotains two columns "Value1" and "Value2" that are fetched from database Your filled data into a temp DataTable and add an extra column into the temp Data table its name "Sum".

In this case ur trying to add the both value into sum coulmn. Here is code that fullfill ur requirement.

 foreach (DataGridViewRow drRow in this.testDataGridView.Rows)
                {
                    // Add the values of first two columns and assinged them to new created 
                    // temp column into data Grid. 
                    drRow.Cells[2].Value = Convert.ToInt32(drRow.Cells[0].Value.ToString()) + Convert.ToInt32(drRow.Cells[1].Value.ToString());
                }
Good luck.


Malik M.Shahid  Saturday, August 08, 2009 9:24 AM
Hi,

For e.g your data GridView Cotains two columns "Value1" and "Value2" that are fetched from database Your filled data into a temp DataTable and add an extra column into the temp Data table its name "Sum".

In this case ur trying to add the both value into sum coulmn. Here is code that fullfill ur requirement.

 foreach (DataGridViewRow drRow in this.testDataGridView.Rows)
                {
                    // Add the values of first two columns and assinged them to new created 
                    // temp column into data Grid. 
                    drRow.Cells[2].Value = Convert.ToInt32(drRow.Cells[0].Value.ToString()) + Convert.ToInt32(drRow.Cells[1].Value.ToString());
                }
Good luck.


Malik M.Shahid  Saturday, August 08, 2009 9:24 AM
hi, thank u so much for helping me
xplorsoftware  Tuesday, August 11, 2009 5:22 AM

You can use google to search for other answers

Custom Search

More Threads

• Repetitive Text Inserting in Internet Explorer
• Details regarding UndoEngine Class in .NET
• Windows form gets maximised.
• Focus of a Nullable DateTimePicker
• Data grid enter event...
• Differents types of ListBox Control
• Good Book or Set of Rules for Control Development
• Custom component not being destroyed properly
• ** DataGrid's COntent's bein Exported easily but...........**
• Menu item with an Icon to the left.