|
-
Mar 24th, 2010, 08:16 AM
#1
Thread Starter
Lively Member
[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
Last edited by Kielo; Mar 24th, 2010 at 08:24 AM.
Reason: code edit
-
Mar 24th, 2010, 08:25 AM
#2
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
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Mar 24th, 2010, 08:53 AM
#3
Thread Starter
Lively Member
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
-
Mar 24th, 2010, 08:54 AM
#4
Fanatic Member
Re: Program help... checkbox?
Personally, I would use a ComboBox. Saves space.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Mar 24th, 2010, 08:55 AM
#5
Re: Program help... checkbox?
Show some code and I'll help
Look at checkbox.Checked
and
radiobutton.Check
status
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Mar 24th, 2010, 09:46 AM
#6
Thread Starter
Lively Member
Re: Program help... checkbox?
I'll tackle that now, thanks!
-
Mar 24th, 2010, 10:04 AM
#7
Thread Starter
Lively Member
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|