Results 1 to 11 of 11

Thread: Option Strict Errors FIGURED OUT

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    131

    Question 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
    Last edited by twisted; Jun 8th, 2004 at 09:03 AM.
    Twisted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width