[RESOLVED] Program help... checkbox?
In my program, I can place an order for glasses.
To do this, I have 4 text boxes:
StockNumber: [12345]
GlassOrPlastic: [Glass/Plastic]
ScratchCoating: [Yes/No]
UVFilter: [Yes/No]
Currently, it works fine... BUT I need to type in Glass or Plastic, I need to type Yes/No and same for each thing, wondering would checkboxes be more effecient or how would I do it?
How do I even use checkboxes to get the same values...
(If I type in Glass it adds €30 to the price, if I type in Plastic only €15 is added...)
So if a Yes answer = €20 and a No = €10
How can I do that with checkboxes or whatever...
My code for when I click the order button, myAddNew just adds my information in..
ok Code:
Private Sub OrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrderButton.Click
Dim myValue As Integer ' Base value of frames
Dim myValue1 As Integer ' Glass or plastic value
Dim myValue2 As Integer ' Scratch Coating value
Dim myValue3 As Integer ' UV value
Dim totalCost As Integer ' Total value
Dim deposit As Integer ' Deposit value, 20% of total
myValue = 50 'Base value of frames, always 50
Select Case GPTextBox.Text
Case "Glass"
myValue1 = 30
Case "Plastic"
myValue1 = 15
End Select
Select Case ScratchTextBox.Text
Case "Yes"
myValue2 = 10
Case "No"
myValue2 = 0
End Select
Select Case UVTextBox.Text
Case "Yes"
myValue3 = 15
Case "No"
myValue3 = 0
End Select
totalCost = myValue + myValue1 + myValue2 + myValue3 'Gets total by adding all values
deposit = totalCost * 0.2 'Divides total by 0.2 to find the 20% deposit
TextBox1.Text = totalCost 'Displays total
TextBox2.Text = deposit 'Displays deposit
TextBox3.Text = totalCost - deposit 'Subtracts the deposit from total, to find balance
PrintButton.Enabled = True
ViewButton.Enabled = True
myAddNew(8) 'CALLS ADDNEW METHOD WHEN ADD BUTTON IS CLICKED
End Sub
Re: Program help... checkbox?
I would place a grouopboxe on the form for Glass/Plastic (Glass Type) in that group box use two radiobutton control (that way only one can be choisen) 1 for Glass the other for Plastic
as for the Others I would use checkboxes that say: Add UVFitler (if checked then Yes other wise No)
and the other says: Add Scratch Coating (if checked then Yes other wise No)
The database would hold a True/False value for the last two values the Lens Type would hold a smallint vaule 1 for Glass 2 for Plastic
Re: Program help... checkbox?
Sound good, what way can I code that then to do the same thing it's doing now...
Sorry for asking that, but I'm crap with anything besides textboxes :(
Re: Program help... checkbox?
Personally, I would use a ComboBox. Saves space.
Re: Program help... checkbox?
Show some code and I'll help
Look at checkbox.Checked
and
radiobutton.Check
status
Re: Program help... checkbox?
I'll tackle that now, thanks!
Re: Program help... checkbox?
vb Code:
If GlassRadioButton.Checked = True Then
myValue2 = 30
ElseIf PlasticRadioButton.Checked = True Then
myValue2 = 15
End If
Works a charm, thanks again Gary