Wednesday 15 July 2015

vb.net - Error: Option Strict On disallows implicit conversions from 'Object' to 'Decimal' -


I'm typing to check the value of cell J34 (excel) if the value is empty, display the message , If the rest of the code is not run.

However, when I am compiling, I get an error on the line:

decAnnualMid = Convert ToDecimal (Globals.dsbPositionBoard.Range ("J34"). Value) < / P>

My code here

  Chk10thPercentile_CheckedChanged on the explicit private sub-option (as the rest of this object, as the E EventArgs) handle chk10thPercentile.CheckedChanged ' The event runs when the 10th checkbox is selected 'The event clears the cells where the price will be pasted' calculationShet entering the value from the cell J34 in the H45 And clears 'check box for the 25th, 50th, 75th, 90th and other zodiac' checkbox DMADDVAL MIDI if in decimal form as in decimal form. = Truth and Globals.Dispositionboard.range ("J34"). Value is DBNBL Value 'display. The user has not selected any location in the dashboard. The value of the MsgBox K34 is in decimal ("not a value for the market data section 10th percentile of the status dashboard.", MsgBoxStyle.Critical, "Input Error") Me.Close () or 'convert and decAnnualMid = Convert .ToDecimal ( Globals.dsbPositionBoard.Range ("J34"). Value labeled label label lblAnnualMid.Text = decAnnualMid.ToString ('C') display in lblHourlyMid 'DecHourlyMid = DecAnnualMid / Convert Annual Salary for 52/40'. Text = decHourlyMid.ToString ("C") Uncheck all other box boxes chk25th values. Checked = wrong chk50th per second. Checked = false chk75th vendor Check = wrong chk90th rep. Checked = wrong chkOtherAmount.Checked = False End If End Sub  

range (" J34 ") produces an object object object, not a range. You will have to cast the option to be happy over:

  dim sel range = CTYPE (Globals.dsbPositionBoard.Range ("J34"), range) decAnnualMid = Convert.ToDecimal form In (sel. Value)    

No comments:

Post a Comment