Public Class Project6
Dim SelectorInteger As Integer
Dim ArrayInteger(6, 4) As Integer
Dim MyDialogResult As DialogResult
Private Sub Project6_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ArrayInteger(0, 0) = 40D
ArrayInteger(1, 0) = 50D
ArrayInteger(2, 0) = 21D
ArrayInteger(3, 0) = 25D
ArrayInteger(4, 0) = 50D
ArrayInteger(5, 0) = 25D
ArrayInteger(6, 0) = 20D
ArrayInteger(0, 1) = 43D
ArrayInteger(1, 1) = 43D
ArrayInteger(2, 1) = 36D
ArrayInteger(3, 1) = 25D
ArrayInteger(4, 1) = 75D
ArrayInteger(5, 1) = 33D
ArrayInteger(6, 1) = 35D
ArrayInteger(0, 2) = 55D
ArrayInteger(1, 2) = 65D
ArrayInteger(2, 2) = 48D
ArrayInteger(3, 2) = 25D
ArrayInteger(4, 2) = 100D
ArrayInteger(5, 2) = 41D
ArrayInteger(6, 2) = 47D
ArrayInteger(0, 3) = 68D
ArrayInteger(1, 3) = 78D
ArrayInteger(2, 3) = 61D
ArrayInteger(3, 3) = 25D
ArrayInteger(4, 3) = 125D
ArrayInteger(5, 3) = 50D
ArrayInteger(6, 3) = 60
ArrayInteger(0, 4) = 90D
ArrayInteger(1, 4) = 110D
ArrayInteger(2, 4) = 86D
ArrayInteger(3, 4) = 25D
ArrayInteger(4, 4) = 150D
ArrayInteger(5, 4) = 60D
ArrayInteger(6, 4) = 90D
End Sub
Private Sub LookupCostButton_Click(sender As System.Object, e As System.EventArgs) Handles LookupCostButton.Click
'Dim RowInteger, ColumnInteger As Integer
'Dim SalePriceDecimal As Decimal
Dim BooleanFound As Boolean = False
If SpaServiceComboBox.Text <> "" And OneFourthHourRadioButton.Checked = True And RoomNumberListBox.SelectedIndex <> -1 Or
HalfHourRadioButton.Checked = True And SpaServiceComboBox.Text <> "" And RoomNumberListBox.SelectedIndex <> -1 Or
ThreeFourthRadioButton.Checked = True And SpaServiceComboBox.Text <> "" And RoomNumberListBox.SelectedIndex <> -1 Or
HourRadioButton.Checked = True And SpaServiceComboBox.Text <> "" And RoomNumberListBox.SelectedIndex <> -1 Or
HourAndHalfRadioButton.Checked = True And SpaServiceComboBox.Text <> "" And RoomNumberListBox.SelectedIndex <> -1 Then
For i As Integer = 0 To SpaServiceComboBox.Items.Count - 1
For y As Integer = 0 To SelectorInteger
For x As Integer = 0 To RoomNumberListBox.Items.Count - 1
If SpaServiceComboBox.SelectedIndex = i And RoomNumberListBox.SelectedIndex = x And SelectorInteger = y Then
MessageBox.Show(SpaServiceComboBox.Items(i).ToString & " reserved room " &
RoomNumberListBox.Items(x).ToString & " cost " & ArrayInteger(x, y), "Room reservation")
SpaServiceComboBox.Text = ""
RoomNumberListBox.SelectedIndex = -1
BooleanFound = True
End If
'Exit For
Next x
Next y
Next i
Else
MessageBox.Show("Please select a Spa Service, Room, and Amount of time you'd like to reserve and get the cost", "Fill out all info")
End If
End Sub
Private Sub RadioButtons_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles OneFourthHourRadioButton.CheckedChanged,
HalfHourRadioButton.CheckedChanged, ThreeFourthRadioButton.CheckedChanged, HourRadioButton.CheckedChanged, HourAndHalfRadioButton.CheckedChanged
Dim RadioButtonselector As RadioButton
RadioButtonselector = CType(sender, RadioButton)
If RadioButtonselector.Checked = OneFourthHourRadioButton.Checked Then
SelectorInteger = 0
ElseIf RadioButtonselector.Checked = HalfHourRadioButton.Checked Then
SelectorInteger = 1
ElseIf RadioButtonselector.Checked = ThreeFourthRadioButton.Checked Then
SelectorInteger = 2
ElseIf RadioButtonselector.Checked = HourRadioButton.Checked Then
SelectorInteger = 3
Else
SelectorInteger = 4
End If
End Sub
I am a beginner at Visual Basic, and my teacher wants a multidimensional code that will cause this spa service price to come up with those values. How could I make the array work, and have the currency to come up in the ServicePriceTextBox?
This post has been edited by modi123_1: 07 November 2012 - 03:18 PM
Reason for edit:: highlight the text and just click the 'code' button in the text editor

New Topic/Question
Reply



MultiQuote




|