February 23, 2017

Homework Help: Visual Basic

Posted by Reese on Friday, February 25, 2011 at 3:52pm.

Alright, so I'm trying to code a program to where I can plug in two numbers and get a commission cost out of them.

I'm having a hard time setting up the code, and I'm really looking for some guidance. I have this as the code so far:

Public Class Form1
'Declare module-lvel variables and constants
Private SellingPriceInteger, CostValueInteger As Integer
Const COMMISSION_RATE_Decimal As Decimal = 0.2D
Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
'Prints the Form.
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
End Sub
Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
'Calculates the Comission
Dim SalesPriceInteger As Integer, CostValueInteger As Integer
Dim COMMISSION_RATE_Decimal As Decimal = 0.2D

'Convert quantity to numeric variable.
SalesPriceInteger = Integer.Parse(SPTextBox.Text)
Catch ex As Exception

End Try

'Convert price if quantity was successful.

Catch ex As Exception

End Try
End Sub
End Class

Basically, I'm in need of some guidance when it comes to Try/Catch, along with figuring out if what I'm typing would work, or if I'm missing a code that defines Integer.

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions