5 Replies - 7185 Views - Last Post: 12 October 2011 - 08:38 AM Rate Topic: -----

#1 licel  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 79
  • Joined: 13-September 11

HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 02:14 AM

ei guys how to compute values in a datagrid column.. we have just tried some codes but it appers false anyway.. just need it badly.. i just have 30 min. :CCC
Is This A Good Question/Topic? 0
  • +

Replies To: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

#2 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1820
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 02:19 AM

What do you want to compute? do the loop fails? What you have tried that fails?
We need to know so we can help........ Just Idea, I can loop through the column like:
For i As Integer = 0 To DGV.RowsCOunt - 2
   'DGV.Rows(i).Cells(0).Value  <---This will give all values of the first column
Next

Was This Post Helpful? 0
  • +
  • -

#3 licel  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 79
  • Joined: 13-September 11

Re: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 02:55 AM

label.text = me.datagridview.currentcell.value

this is our code.. but it just display what you have click.. how to do it if it is multiple..? (selectec cells)
Was This Post Helpful? -1
  • +
  • -

#4 smohd  Icon User is offline

  • Critical Section
  • member icon


Reputation: 1820
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 03:07 AM

As I said, looping. You have to loop through all selected cells, like this:
For Each x2 As DataGridViewTextBoxCell In DataGridView1.SelectedCells
    'do something
 Next

Was This Post Helpful? 0
  • +
  • -

#5 licel  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 79
  • Joined: 13-September 11

Re: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 08:17 AM

Dim netpay As Double
For total As Integer = 0 To Me.DataGridView.RowCount - 1
netpay += Convert.ToDouble(DataGridView.Rows(total).Cells(3).Value)
Next
nettotal.Text = netpay.ToString()

this is our code.. it computes the other row of numbers but not the one we want to be computed.. what would we change or remove.?
Was This Post Helpful? 0
  • +
  • -

#6 licel  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 79
  • Joined: 13-September 11

Re: HOW TO COMPUTE VALUES in a DATAGRID COLUMN

Posted 12 October 2011 - 08:38 AM

FIXED! JUST AN ERROR WITH MY DATA . THANKS ANYWAY.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1