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
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"
Next
grdComm.DataSource = Nothing
grdComm.DataSource = DsInvoice1
ElseIf rdono.Checked Then
For Each dr In DsInvoice1.Tables(0).Rows
dr.Item("Total"
Next
grdComm.DataSource = Nothing
grdComm.DataSource = DsInvoice1
End If