/ Published in: VB.NET
try...
Expand |
Embed | Plain Text
Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savebtn.Click daCustomer.Fill(dsCustomer) Dim Rows As DataRow = dsCustomer.CUSTOMER.NewRow Try Rows("Telno") = CInt(TelNoTextBox.Text) Rows("Name") = NameTextBox.Text Rows("Address") = AddTextBox.Text Rows("Area") = AreaTextBox.Text Rows("OrderNo") = OrderTextBox.Text dsCustomer.CUSTOMER.Rows.Add(Rows) daCustomer.Update(dsCustomer) MessageBox.Show("Record succsesfully saved") Catch ex As Exception MessageBox.Show("Invalid Data") End Try Dim price As Integer Dim radioValue As String If Offer1Radbtn.Checked = True Then radioValue = "offer 1" price = 30 ElseIf Offer2Radbtn.Checked = True Then radioValue = "offer 2" price = 45 ElseIf Offer3Radbtn.Checked = True Then radioValue = "offer 3" price = 50 ElseIf Offer4RadBtn.Checked = True Then radioValue = "offer 4" price = 72 Else radioValue = "not selected" End If Dim price2 As Integer Dim radioValueCrust As String If ClassichandRadbtn.Checked = True Then radioValueCrust = "classic" price2 = 0 ElseIf CrunchyThinRadbtn.Checked = True Then radioValueCrust = "crunchy" price2 = 2 ElseIf CheeseDoubleRadbtn.Checked = True Then radioValueCrust = "cheese" price2 = 5 Else radioValue = "not selected" End If Dim totalprice As Integer totalprice = price + price2 daOrder.Fill(DsOrder) Dim Rows1 As DataRow = DsOrder.ORDER.NewRow Try Rows1("OrderNo") = OrderTextBox.Text Rows1("PizzaOffer") = radioValue Rows1("CrustType") = radioValueCrust Rows1("TotalPrice") = totalprice MessageBox.Show("Record succsesfully saved") Catch ex As Exception MessageBox.Show("Invalid Data") End Try End Sub
You need to login to post a comment.
