Option Strict Errors FIGURED OUT
My program works fine with option strict off but my instructor says it has to be on. Can someone tell me why I'm getting errors and how to fix them?? My errors all say Option Strict On disallows implicit conversions from 'Double' to 'String'. I highlighted where I'm getting the errors. And when I change when I change the grpSalespersons.Text to SP, grpTotalSales.Text to TS, and grpAverageSales.Text to AV; the errors go away but my program doesn't work anymore. Please help!
' Set up constants for Base pay(BP) = $500 and commission(CM) is 6%
Const BP As Double = 500.0
Const CM As Double = 0.06
Dim SA As Double
Dim GP As Double
Dim SP As Double
Dim TS As Double
Dim AV As Double
Private Sub btnGross_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGross.Click
SA = Val(nudSales.Text)
SP = Val(grpSalespersons.Text)
TS = Val(grpTotalSales.Text)
AV = Val(grpAverageSales.Text)
' Compute value and display in Gross Pay
GP = BP + SA * CM
txtGross.Text = Format(GP, "$#####0.00")
' Compute value and display in Salespersons
grpSalespersons.Text = SP + 1
' Compute value and display in Total Sales
grpTotalSales.Text = SA + TS
' Compute value and display in Average Sales
grpAverageSales.Text = TS / SP
End Sub
Re: Re: Option Strict Errors
Quote:
Originally posted by Carnifex
Been a very long time since I did ordinary VB at Uni, so I may be wrong but doesn't VB use variant and doesn't have events or handlers? Even still he shouldn't be posting in the ordinary vb forum in that case.
Yes, VB6 has variants, yes VB6 has event and event handlers.... but the code he's posted is clearly VB.NET....
TG