Please Help!!!!!!! VB Beginner here.. I'm desperate.
Author |
Message |
Special Delivery
|
Posted: Sun Oct 28, 2007 1:33 pm Post subject: Please Help!!!!!!! VB Beginner here.. I'm desperate. |
|
|
Please help! I'm a desperate VB beginner.... Im trying to make a Converter that adds, minuses, multiplies and divides Byte, Integer, Double, String. The four have an individual ComboBox so you can choose between +,-, *, \
I was going to do "Or" but I failed miserably. (ie. + or - or * or \)
Here's the code so far..
Option Explicit On
Option Strict On
Public Class Converter
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim byteA As Integer = 0
Dim byteB As Integer = 0
Dim byteTotal As Integer = 0
Dim integerA As Integer = 0
Dim integerB As Integer = 0
Dim integerTotal As Integer = 0
Dim doubleA As Double = 0.0
Dim doubleB As Double = 0.0
Dim doubleTotal As Double = 0.0
Dim stringA As Integer
Dim stringB As Integer
Dim stringTotal As Integer
Dim grandTotal As Integer = 0
Dim isConverted As Boolean = False
isConverted = Integer.TryParse(txtByte1.Text, byteA)
isConverted = Integer.TryParse(txtByte2.Text, byteB)
isConverted = Integer.TryParse(txttotalByte.Text, byteTotal)
isConverted = Integer.TryParse(txtInteger1.Text, integerA)
isConverted = Integer.TryParse(txtInteger2.Text, integerB)
isConverted = Integer.TryParse(txttotalInteger.Text, integerTotal)
isConverted = Double.TryParse(txtDouble1.Text, doubleA)
isConverted = Double.TryParse(txtDouble2.Text, doubleB)
isConverted = Double.TryParse(txttotalDouble.Text, doubleTotal)
isConverted = Integer.TryParse(txtString1.Text, stringA)
isConverted = Integer.TryParse(txtString2.Text, stringB)
isConverted = Integer.TryParse(txttotalString.Text, stringTotal)
If cboBoxByte.SelectedIndex <> -1 Then
Select Case (cboBoxInteger.SelectedIndex)
Case 1
byteTotal = byteA + byteB
txttotalByte.Text = byteTotal.ToString
Case 2
byteTotal = byteA - byteB
txttotalByte.Text = byteTotal.ToString
Case 3
byteTotal = byteA * byteB
txttotalByte.Text = byteTotal.ToString
Case 4
byteTotal = byteA \ byteB
txttotalByte.Text = byteTotal.ToString
End Select
End If
If cboBoxInteger.SelectedIndex <> -1 Then
Select Case (cboBoxInteger.SelectedIndex)
Case 1
integerTotal = integerA + integerB
txttotalInteger.Text = integerTotal.ToString()
Case 2
integerTotal = integerA - integerB
txttotalInteger.Text = integerTotal.ToString()
Case 3
integerTotal = integerA * integerB
txttotalInteger.Text = integerTotal.ToString()
Case 4
integerTotal = integerA \ integerB
txttotalInteger.Text = integerTotal.ToString()
End Select
End If
If cboBoxDouble.SelectedIndex <> -1 Then
Select Case (cboBoxDouble.SelectedIndex)
Case 1
doubleTotal = doubleA + doubleB
txttotalDouble.Text = doubleTotal.ToString()
Case 2
doubleTotal = doubleA - doubleB
txttotalDouble.Text = doubleTotal.ToString()
Case 3
doubleTotal = doubleA * doubleB
txttotalDouble.Text = doubleTotal.ToString()
Case 4
doubleTotal = CLng(doubleA) \ CLng(doubleB)
txttotalDouble.Text = doubleTotal.ToString()
End Select
End If
End Sub |
|
|
|
|
|
Sponsor Sponsor
|
|
|
MIdas0036
|
Posted: Sun Jan 13, 2008 11:45 am Post subject: Re: Please Help!!!!!!! VB Beginner here.. I'm desperate. |
|
|
Post the program and PM me when you do i may be able to help you |
|
|
|
|
|
|
|