calculated column in datagridview

Joined
Oct 29, 2012
Messages
2
Reaction score
0
Hi friends
I am new to vb.net , I am having difficulty to add a calculated column to calculate
amount = salesPrice*qty
please help me

Code:
 DataGridView1.ColumnCount = 5
        DataGridView1.Columns(0).Name = "Product ID"
        DataGridView1.Columns(1).Name = "Product Name"
        DataGridView1.Columns(2).Name = "salesPrice"
        DataGridView1.Columns(3).Name = "qty"
        DataGridView1.Columns(4).Name = "amount"

        Dim row As String() = New String() {"1", "Product 1"}
        DataGridView1.Rows.Add(row)
        row = New String() {"2", "Product 2"}
        DataGridView1.Rows.Add(row)
        row = New String() {"3", "Product 3"}
        DataGridView1.Rows.Add(row)
        row = New String() {"4", "Product 4"}
        DataGridView1.Rows.Add(row)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top