System.InvalidCastException Error when running code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmdolcet69

    #1

    System.InvalidCastException Error when running code

    In the below code exact line If _graphicScreenS hots(intloop) =
    "Summary" Then....... I get an error message

    Overload resolution failed because no Public '=' can be called with
    these arguments:
    'Public Shared Operator =(a As String, b As String) As Boolean':
    Argument matching parameter 'a' cannot convert from 'Bitmap'
    to 'String'.


    Code:

    //
    *************** *************** *************** *************** *************** *************** *************** *************
    Private Sub AddSummaryInfor mation()
    If _graphicScreenS hots.Count 0 Then
    Dim intloop As Integer
    For intloop = 0 To _graphicScreenS hots.Count - 1


    If _graphicScreenS hots(intloop) = "Summary" Then



    Dim transaction As
    System.Componen tModel.Design.D esignerTransact ion =
    host.CreateTran saction("Drop Field")
    Try
    Dim report As
    DevExpress.Xtra Reports.UI.Xtra Report = reportDesigner. RootReport
    Dim tmpPicBox As
    DevExpress.Xtra Reports.UI.XRCo ntrol =
    DevExpress.Xtra Reports.Design. FieldDragHandle r.CreateXRContr ol(GetType(XRPi ctureBox),
    reportDesigner. RootReport.Band s(DevExpress.Xt raReports.UI.Ba ndKind.Detail),
    New System.Drawing. Point(0, 0), Nothing, reportDesigner. SnapToGrid,
    reportDesigner. GridSize)

    With CType(tmpPicBox , XRPictureBox)
    .Image = _graphicScreenS hots(intloop + 1)
    .Sizing =
    DevExpress.Xtra Printing.ImageS izeMode.Stretch Image
    .Tag = "Summary Graphic"
    End With

    myNC.ControlNam e = "picSummary "
    AddToContainer( host, tmpPicBox)
    Catch ex As Exception
    _TListener.AddM ethodError(ex)
    Finally
    transaction.Com mit()
    End Try

    Exit For
    End If
    Next
    End If
    End Sub

  • Robin Tucker

    #2
    Re: System.InvalidC astException Error when running code


    Hi,

    Presumably _graphicScreenS hots is an array of bitmaps? You can't compare a
    bitmap to "string".





    Robin


    Comment

    Working...