Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datagrid and radio button

Status
Not open for further replies.

smithbr

MIS
May 29, 2003
85
US
hello all,
Does anyone know how to make it so that a column that is calculated will base its calculation on which of two radio buttons is checked. IF yes is check I want the calculation to take the discount off the total, if no is checked I do not wan tit to take the discount off the total. Also, If I do this i am assumming I will need to have some event behind the buttons themselves in case the user changes after the datagrid has been filled...here the code that I tried...does anyone know what I should do?

OleDbDataAdapter1.SelectCommand.Parameters(0).Value = txtinvnum.Text
OleDbDataAdapter1.Fill(DsInvoice1)
Try
DsInvoice1.Tables(0).Columns.Remove("Total")
Catch
End Try

DsInvoice1.Tables(0).Columns.Add("Total")
Dim dr As DataRow

If rdoyes.Checked Then
For Each dr In DsInvoice1.Tables(0).Rows
dr.Item("Total") = ((dr.Item("QuantityShipped") * dr.Item("LastUnitPrice")) * (1 - dr.Item("DiscountP")))
Next
grdComm.DataSource = Nothing
grdComm.DataSource = DsInvoice1
ElseIf rdono.Checked Then
For Each dr In DsInvoice1.Tables(0).Rows
dr.Item("Total") = dr.Item("Total") = dr.Item("QuantityShipped") * dr.Item("LastUnitPrice")

Next
grdComm.DataSource = Nothing
grdComm.DataSource = DsInvoice1
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top