Results 1 to 3 of 3

Thread: [RESOLVED] [2008] Option Strict On disallows implicit conversions from 'Double' to 'Int

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    Resolved [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

  2. #2
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    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)))))
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    Re: [2008] Option Strict On disallows implicit conversions from 'Double' to 'Int

    Thanks CL. That worked fine

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