[RESOLVED] [2008] Option Strict On disallows implicit conversions from 'Double' to 'Int
Please can someone help me debug this line to allow for Option Strict on. I am using this progressbar to show status of WebBrowser1_ProgressChanged
Code:
ToolStripProgressBar1.Value = Math.Min(ToolStripProgressBar1.Maximum, Convert.ToDouble(Math.Floor(ToolStripProgressBar1.Maximum * (d / t))))
I get the error
Option Strict On disallows implicit conversions from 'Double' to 'Integer'.
Here is the entire codebock:
Code:
ToolStripProgressBar1.Visible = True
Dim d, t As Long
d = e.CurrentProgress
t = e.MaximumProgress
If d <= 0 Then
ToolStripProgressBar1.Value = 0
ToolStripProgressBar1.Visible = False
ToolStripStatusLabel1.Text = "Ready"
ToolStripStatusLabel1.ForeColor = Color.Black
Else
ToolStripProgressBar1.Value = Math.Min(ToolStripProgressBar1.Maximum, Convert.ToDouble(Math.Floor(ToolStripProgressBar1.Maximum * (d / t))))
ToolStripStatusLabel1.Text = "Please wait. Loading..."
ToolStripStatusLabel1.ForeColor = Color.Black
End If
Re: [2008] Option Strict On disallows implicit conversions from 'Double' to 'Int
Quote:
Originally Posted by Xancholy
Code:
ToolStripProgressBar1.Value = Math.Min(ToolStripProgressBar1.Maximum, Convert.ToDouble(Math.Floor(ToolStripProgressBar1.Maximum * (d / t))))
[/CODE]
change it to
Code:
ToolStripProgressBar1.Value = cInt(Math.Min(ToolStripProgressBar1.Maximum, Convert.ToDouble(Math.Floor(ToolStripProgressBar1.Maximum * (d / t)))))
Re: [2008] Option Strict On disallows implicit conversions from 'Double' to 'Int
Thanks CL. That worked fine