By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,601 Members | 989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,601 IT Pros & Developers. It's quick & easy.

Datagrid

P: n/a
sch
Hi
I am using a datagrid in VB.NET. When I am adding data
one of my cells should get data aitomatically from the
other cells like adding the price in 2nd and 3rd cells
should compute sum and put in the 4th cell.
Any help is greatly appreciated.
Thanks
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Add a calculated column to the dataset. Here is an example

Private Sub AddPrice()

Dim dc As DataColumn

dc = New DataColumn("Price")

dc.DataType = System.Type.GetType("System.Decimal")

dc.Expression = "Quantity * Each"

dsInvoicesData.Tables(0).Columns.Add(dc)

dc = Nothing

End Sub

Ken
-----------------
"sch" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Hi
I am using a datagrid in VB.NET. When I am adding data
one of my cells should get data aitomatically from the
other cells like adding the price in 2nd and 3rd cells
should compute sum and put in the 4th cell.
Any help is greatly appreciated.
Thanks

Jul 21 '05 #2

P: n/a
Hi,

Add a calculated column to the dataset. Here is an example

Private Sub AddPrice()

Dim dc As DataColumn

dc = New DataColumn("Price")

dc.DataType = System.Type.GetType("System.Decimal")

dc.Expression = "Quantity * Each"

dsInvoicesData.Tables(0).Columns.Add(dc)

dc = Nothing

End Sub

Ken
-----------------
"sch" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Hi
I am using a datagrid in VB.NET. When I am adding data
one of my cells should get data aitomatically from the
other cells like adding the price in 2nd and 3rd cells
should compute sum and put in the 4th cell.
Any help is greatly appreciated.
Thanks

Jul 21 '05 #3

P: n/a
sch
Hi Ken,
Thanks for your code but when using your expression -
dc.Expression = "Quantity * Each"

I am repalcing quntity as follows
datatable1(datagrid1.currentrowindex)("Expression" )

it is giving error as the currentrowindex is not yet saved
in the datagrid. My problem is I wanted to see the values
on the grid before the that new row is saved.

Thanks
Chs
-----Original Message-----
Hi,

Add a calculated column to the dataset. Here is an example
Private Sub AddPrice()

Dim dc As DataColumn

dc = New DataColumn("Price")

dc.DataType = System.Type.GetType("System.Decimal")

dc.Expression = "Quantity * Each"

dsInvoicesData.Tables(0).Columns.Add(dc)

dc = Nothing

End Sub

Ken
-----------------
"sch" <an*******@discussions.microsoft.com> wrote in messagenews:00****************************@phx.gbl...
Hi
I am using a datagrid in VB.NET. When I am adding data
one of my cells should get data aitomatically from the
other cells like adding the price in 2nd and 3rd cells
should compute sum and put in the 4th cell.
Any help is greatly appreciated.
Thanks

.

Jul 21 '05 #4

P: n/a
sch
Hi Ken,
Thanks for your code but when using your expression -
dc.Expression = "Quantity * Each"

I am repalcing quntity as follows
datatable1(datagrid1.currentrowindex)("Expression" )

it is giving error as the currentrowindex is not yet saved
in the datagrid. My problem is I wanted to see the values
on the grid before the that new row is saved.

Thanks
Chs
-----Original Message-----
Hi,

Add a calculated column to the dataset. Here is an example
Private Sub AddPrice()

Dim dc As DataColumn

dc = New DataColumn("Price")

dc.DataType = System.Type.GetType("System.Decimal")

dc.Expression = "Quantity * Each"

dsInvoicesData.Tables(0).Columns.Add(dc)

dc = Nothing

End Sub

Ken
-----------------
"sch" <an*******@discussions.microsoft.com> wrote in messagenews:00****************************@phx.gbl...
Hi
I am using a datagrid in VB.NET. When I am adding data
one of my cells should get data aitomatically from the
other cells like adding the price in 2nd and 3rd cells
should compute sum and put in the 4th cell.
Any help is greatly appreciated.
Thanks

.

Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.