Hello every one!

I'm new to vb.net
could someone please help me with some code?
I have got a datagrid, connecting data from acces.What
i need is on the datagrid column(1) * column(2) = column(3) and column(3) add sum into a textbox

please help me...
thanks.

First off, you will need to change the SQL statement that is populating your datagrid to something similar to:

SELECT TABLE.Col1, TABLE.Col2, TABLE.Col1*TABLE.Col2 AS Col3
FROM TABLE;

Then for summing Col3 to a textbox you will need to write a for loop. Something similar to:

Dim drrow As DataRow 
        For Each drrow In DataSet1.Tables("TABLENAME").Rows
                total =  total + double.parse(DataSet1.Tables("TABLENAME").Rows(introw).Item("Col3"))
            introw += 1
        Next
'Now just store that total in the textbox

Hello there
Thank you every much for your code. They are working alright. I would like to ask one more question.
Also I’m having a problem when I enter a new value to datagrid manually.
Is there any way that I can calculate this without connecting to database(SQL).

For example

Datagrid1.column(1)*column(2)=column(3)


txtTotal = datagrid1.column(3).(items)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.