title: Converting VB 6 code to VB.NET
body: <p>I am upgrading code from VB 6 to VB.NET, and the following code gives me an error:</p>
  
  <pre><code>(VB6.PixelsToTwipsX(mvarPicture.ClientRectangle.Width) - (BDR + X), 
  VB6.PixelsToTwipsY(mvarPicture.ClientRectangle.Height) - (BDR + X)),
  mvarBorderColor,
  B
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>Error 6 End of statement expected. </p>
  </blockquote>
  
  <p>Can anyone help me with that?</p>
  
  <hr>
  
  <p>This is the full code:</p>
  
  <pre><code>Public Sub Draw()
      Dim BDR, X As Short
      Dim NewX, NewY As Double
      Dim OldX, OldY As Double
      Dim GridHeight, GridWidth As Double
      Dim mvarPictureBox As System.Windows.Forms.PictureBox
  
  
  
      On Error GoTo NoPicBox ' In case the PicBox isn't set yet
  
      'UPGRADE_ISSUE: PictureBox property mvarPictureBox.AutoRedraw was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
      If mvarPicture.AutoRedraw = False Then mvarPicture.AutoRedraw = True
      'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Cls was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
      mvarPicture.Cls()
  
      BDR = mvarPictureBox.BorderStyle
      'UPGRADE_ISSUE: PictureBox property mvarPictureBox.ScaleMode was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
      If mvarPicture.ScaleMode &lt;&gt; 3 Then mvarPicture.ScaleMode = 3
      If System.Drawing.ColorTranslator.ToOle(mvarPictureBox.BackColor) &lt;&gt; System.Drawing.ColorTranslator.ToOle(mvarPicBackground) Then mvarPictureBox.BackColor = mvarPicBackground
      If mvarBorderSize &gt; 0 Then
          For X = 0 To mvarBorderSize
              'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
              mvarPicture.Line (X, X) - (VB6.PixelsToTwipsX(mvarPicture.ClientRectangle.Width) - (BDR + X), VB6.PixelsToTwipsY(mvarPicture.ClientRectangle.Height) - (BDR + X)), mvarBorderColor, B
          Next X
      End If
  
      ' Display Grid On Screen
      If mvarGridVisible = True Then
          For X = 1 To 20
              'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
              mvarPicture.Line (mvarBorderSize, mvarBorderSize) - ((((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)) / 20) * X), (VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2))), mvarGridColor, B
          Next X
          For X = 1 To 10
              'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
              mvarPicture.Line (mvarBorderSize, mvarBorderSize) - ((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)), (((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) / 10) * X)), mvarGridColor, B
          Next X
      End If
  
      If mvarDataCollection.Count() &gt; 0 Then
          GridHeight = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) / 100) + 0 ' 0-100%
          GridWidth = ((VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)) / 100) + 0 ' 1-100 Items
          Do
              If mvarDataCollection.Count() &gt; 100 Then mvarDataCollection.Remove(1)
          Loop While mvarDataCollection.Count() &gt; 100
  
          OldX = mvarBorderSize + 2
          'UPGRADE_WARNING: Couldn't resolve default property of object mvarDataCollection(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
          OldY = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) - (mvarDataCollection.Item(1) * GridHeight))
          For X = 1 To 100
              NewX = (VB6.PixelsToTwipsX(mvarPictureBox.ClientRectangle.Width) - (mvarBorderSize * 2)) - ((100 - (X - 1)) * GridWidth)
              'UPGRADE_WARNING: Couldn't resolve default property of object mvarDataCollection(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
              NewY = ((VB6.PixelsToTwipsY(mvarPictureBox.ClientRectangle.Height) - (mvarBorderSize * 2)) - (mvarDataCollection.Item(X) * GridHeight))
              NewX = NewX + 2
              If NewX &lt; mvarBorderSize Then NewX = mvarBorderSize
              If NewY &lt; mvarBorderSize Then NewY = mvarBorderSize
  
              'UPGRADE_ISSUE: PictureBox method mvarPictureBox.Line was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
              mvarPicture.Line (OldX, OldY) - (NewX, NewY), mvarPicForeground
  
  
              OldX = NewX : OldY = NewY
              If OldX &lt; mvarBorderSize Then OldX = mvarBorderSize
              If OldY &lt; mvarBorderSize Then OldY = mvarBorderSize
          Next X
      End If
  
  NoPicBox:
  End Sub
  </code></pre>