- This topic is empty.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
October 25, 2011 at 10:57 pm #34910jmeyer0911Member
I am trying to build this in VB 2010, and cant seem to get it right. Can someone please help me..?
I’m trying to write a program that lets a person select a salsa from a listbox (Hot, Medium, Mild, Sweet, Zesty) with the prices, respectively, 3.29, 3.09, 2.98, 2.99, 3.15.
I’m trying to make an array in the program to hold the cost per unit.
I’m also trying to create a function where they would get a discount of 20% if they purchase a total of 500 or more, and if it is 100 – 499, they get 10% discount.
Also trying to make a list box.
Here is what I have so far…or at least destroyed…new at this and trying to see if I like doing this…just need to see a visual of how this would look like. THanks
Option Strict On
Public Class salsaSale
'Declare Module-Level
' Structure salsaBrand
'Dim salsaType As String
'Dim salsaQuantity As String
'Dim salsaPriceDecimal As Decimal
'End Structure
'Private salsaSale(5) As salsaBrand
Private totalSalsaInteger(7) As Integer
Private Sub salsaSale_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'Populate structure
With salsaSale(0)
.salsaType = "Hot Salsa"
.salsaPriceDecimal = 3.19D
End With
With salsaSale(1)
.salsaType = "Medium Salsa"
.salsaPriceDecimal = 3.09D
End With
With salsaSale(2)
.salsaType = "Mild Salsa"
.salsaPriceDecimal = 2.98D
End With
With salsaSale(3)
.salsaType = "Sweet Salsa"
.salsaPriceDecimal = 2.99D
End With
With salsaSale(4)
.salsaType = "Zesty Salsa"
.salsaPriceDecimal = 3.15D
End With
End Sub
Private Sub calculateButton_Click(sender As System.Object, e As System.EventArgs) Handles calculateButton.Click
'Calculates totals
Dim salsaInteger As Integer
Dim indexInteger As Integer
Try
indexInteger = salsaListBox.SelectedIndex
If indexInteger <> -1 Then
salsaInteger = Integer.Parse(preDiscountLabel.Text)
End If
Catch ex As Exception
End Try
End Sub
Private Sub SummaryToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SummaryToolStripMenuItem.Click
'Opens up the summary form and gives amounts of everything
summaryForm.ShowDialog()
End Sub
Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
'Ends the program
Me.Close()
End Sub
-
AuthorPosts
Viewing 1 post (of 1 total)
- The forum ‘Other’ is closed to new topics and replies.