Posted By

nazslash on 12/01/11


Tagged


Versions (?)

for u


 / Published in: VB.NET
 

try...

  1. Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savebtn.Click
  2. daCustomer.Fill(dsCustomer)
  3. Dim Rows As DataRow = dsCustomer.CUSTOMER.NewRow
  4.  
  5. Try
  6. Rows("Telno") = CInt(TelNoTextBox.Text)
  7. Rows("Name") = NameTextBox.Text
  8. Rows("Address") = AddTextBox.Text
  9. Rows("Area") = AreaTextBox.Text
  10. Rows("OrderNo") = OrderTextBox.Text
  11.  
  12. dsCustomer.CUSTOMER.Rows.Add(Rows)
  13. daCustomer.Update(dsCustomer)
  14.  
  15. MessageBox.Show("Record succsesfully saved")
  16. Catch ex As Exception
  17. MessageBox.Show("Invalid Data")
  18. End Try
  19.  
  20. Dim price As Integer
  21. Dim radioValue As String
  22. If Offer1Radbtn.Checked = True Then
  23. radioValue = "offer 1"
  24. price = 30
  25. ElseIf Offer2Radbtn.Checked = True Then
  26. radioValue = "offer 2"
  27. price = 45
  28. ElseIf Offer3Radbtn.Checked = True Then
  29. radioValue = "offer 3"
  30. price = 50
  31. ElseIf Offer4RadBtn.Checked = True Then
  32. radioValue = "offer 4"
  33. price = 72
  34. Else
  35. radioValue = "not selected"
  36. End If
  37.  
  38. Dim price2 As Integer
  39. Dim radioValueCrust As String
  40. If ClassichandRadbtn.Checked = True Then
  41. radioValueCrust = "classic"
  42. price2 = 0
  43. ElseIf CrunchyThinRadbtn.Checked = True Then
  44. radioValueCrust = "crunchy"
  45. price2 = 2
  46. ElseIf CheeseDoubleRadbtn.Checked = True Then
  47. radioValueCrust = "cheese"
  48. price2 = 5
  49. Else
  50. radioValue = "not selected"
  51. End If
  52. Dim totalprice As Integer
  53. totalprice = price + price2
  54.  
  55. daOrder.Fill(DsOrder)
  56.  
  57. Dim Rows1 As DataRow = DsOrder.ORDER.NewRow
  58.  
  59. Try
  60. Rows1("OrderNo") = OrderTextBox.Text
  61. Rows1("PizzaOffer") = radioValue
  62. Rows1("CrustType") = radioValueCrust
  63. Rows1("TotalPrice") = totalprice
  64.  
  65.  
  66. MessageBox.Show("Record succsesfully saved")
  67. Catch ex As Exception
  68. MessageBox.Show("Invalid Data")
  69. End Try
  70. End Sub

Report this snippet  

You need to login to post a comment.