Need some programming help.

M

Mike

Hey guys need some help on the steps getting from one point to another.

Here is the easy part.

I have a combo box that is being loaded with 3 choices (small, medium,
large) no problem here. Then I have 6 checkboxes (red, blue, green, yellow,
white, black) no problem here.

Here is where I am hung up, which is unfortunately the biggest piece!
What I would like to do is to allow the user to choose a size and any
combination of colors and calculate the size plus the cost of each color
they choose. Then put their selection into a list box so they can see their
choices.

Any help would be appreciated! Thanks!!

Mike


Right now I can't seem to get whatever they choose for a size to turn it
into a value. Here is what I have so far.

Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Initialize combo box number
cboSize.Text = "Select Size"
cboSize.Items.Add("Select Size")
cboSize.Items.Add("Small $8.99")
cboSize.Items.Add("Medium $11.99")
cboSize.Items.Add("Large $13.99")
End Sub

Private Sub btnEnterOrder_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnEnterOrder.Click
Dim nOrder As Order
Dim nColor As Order
Dim Color As Integer


nOrder = New Order(cboSize.Text)
nColor = New Order(Color)

Select Case cboSize.Text
Case "Medium $8.99" : cboSize.Text = 8.99
Case "Large $11.99" : cboSize.Text = 11.99
Case "Gigantic $13.99" : cboSize.Text = 13.99
End Select

If chkRed.Checked Then
Color = Color + 1
End If
If chkBlue.Checked Then
Color = Color + 1
End If
If chkWhite.Checked Then
Color = Color + 1
End If
If chkBlack.Checked Then
Color = Color + 1
End If
If chkGreen.checked Then
Color = Color + 1
End If
If chkYellow.Checked Then
Color = Color + 1
End If

lstOrder.Text = nOrder.Cost 'just for testing purposes.
'lstorder will eventually show what is being ordered in
'a list so it can be printed.

End Sub
End Class


Public Class Order

Private mSize As Double
Private mColor As Integer


Public Sub New(ByVal Value As Double)
mSize = Value
End Sub

ReadOnly Property color(ByVal Value1 As Integer)
Get
mColor = Value1

End Get
End Property

Public Function Cost() As Double
Dim sCost As Double


sCost = mSize + (mColor * 0.99)


End Function
End Class
 
M

Mike

Sorry

I fixed this!


Select Case cboSize.Text
Case "Medium $8.99" : cboSize.Text = 8.99
Case "Large $11.99" : cboSize.Text = 11.99
Case "Gigantic $13.99" : cboSize.Text = 13.99
End Select

to

Select Case cboSize.Text
Case "Small $8.99" : cboSize.Text = 8.99
Case "Medium $11.99" : cboSize.Text = 11.99
Case "Large $13.99" : cboSize.Text = 13.99
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top