|
-
Apr 3rd, 2011, 04:54 AM
#1
Thread Starter
New Member
HELP please.
Hey guys,
I'm sure this is in the wrong section, I don't know where to put it, I'm sorry.
So I'm making program that calculates the cost of a call based on data inputted, but I am have a major problem, I keep getting an error saying "Conversion from string "" to type 'Double' is not valid."
I have been searching for days and I understand the problem, that I cannot convert an empty string to a double, but what do I do?
Here is the code:
Code:
Public Class Form1
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblAccountLabel.Click
End Sub
Private Sub Label1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTelephoneLabel.Click
End Sub
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblBasic.Click
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim iAccount As Integer
Dim sTelephone As String
Dim sPlan As String
Dim iDuration As Integer
Dim dDate As Date
Dim dCountry As Double
Dim iTime As Integer
Dim bEvening As Boolean
Dim dFlagfall As Double
Dim dBasic As Double
Dim dPlanDisc As Double
Dim dLoyalty As Double
Dim dTotal As Double
Dim dGST As Double
'Determines Flagfall by inputted plan
sPlan = txtPlan.Text
dFlagfall = CDbl(lblFlagfall.Text) <-- IT POINTS TO THIS WITH THE ERROR
If sPlan = "No Plan" Then
dFlagfall = 2.0
ElseIf sPlan = "Bronze" Then
dFlagfall = 1.5
ElseIf sPlan = "Silver" Then
dFlagfall = 0.75
ElseIf sPlan = "Gold" Then
dFlagfall = 0.25
Else
MsgBox("Unknown Plan")
End If
'Calculates rate per minute by inputted country
dCountry = CDbl(lblCountry.Text)
If txtCountry.Text = "Japan" Then
dCountry = 0.34
ElseIf txtCountry.Text = "China" Then
dCountry = 0.86
ElseIf txtCountry.Text = "India" Then
dCountry = 0.78
ElseIf txtCountry.Text = "UK" Then
dCountry = 0.37
ElseIf txtCountry.Text = "USA" Then
dCountry = 0.42
ElseIf txtCountry.Text = "Canada" Then
dCountry = 0.56
ElseIf txtCountry.Text = "Indonesia" Then
dCountry = 0.38
ElseIf txtCountry.Text = "New Zealand" Then
dCountry = 0.22
ElseIf txtCountry.Text = "Other" Then
dCountry = 1.1
End If
'Displays inputted plan for summary reasons
lblPlan.Text = sPlan
'Calculates basic cost then displays
txtDuration.Text = lblDuration.Text
iDuration = lblDuration.Text
dBasic = lblBasic.Text
dBasic = dFlagfall + (iDuration * dCountry)
'Displays Plan Discount
dPlanDisc = CDbl(lblPlanDiscount.Text)
If sPlan = "No Plan" Then
dPlanDisc = 0
ElseIf sPlan = "Bronze" Then
dPlanDisc = 0.05
ElseIf sPlan = "Silver" Then
dPlanDisc = 0.1
ElseIf sPlan = "Gold" Then
dPlanDisc = 0.15
Else
MsgBox("Unknown Plan")
End If
'Calculates and displays Loyalty discount
dLoyalty = CDbl(lblLoyalty.Text)
dLoyalty = iTime * 0.02
'Calculates and displays total cost
End Sub
Private Sub lblFlagfall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblFlagfall.Click
End Sub
End Class
Any help would be so greatly appreciated and hopefully mods move this to it's correct location.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|