Skip to main content

Notifications

Microsoft Dynamics SL (Archived)

Unable to cast object of type 'System.String' to type 'System.IntPtr'

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am trying to add detail grid for a custom table xBillable, but get this error on form load. Anyone can help me? Thanks.

 

System.InvalidCastException was unhandled   Message="Unable to cast object of type 'System.String' to type 'System.IntPtr'."   Source="Solomon.Kernel"   StackTrace:        at Solomon.Kernel.Exports.DetailSetup(Int16 , Object , Object , SolomonDataObject , Object , Object , Object )        at ST26000.VBTools.DetailSetup(Int16 Cursor, SAFGrid SAFGridCtrl, Object AutoLineNbfFld, SolomonDataObject& bTable1, Object& bTable2, Object& bTable3, Object& bTable4) in )        at ST26000.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81   InnerException:

   

Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load

Call ApplInit()

       

Call SetAddr(LEVEL0, "bCustomer", bCustomer, nCustomer)       

Call SetAddr(LEVEL1, "bXBillable", bXBillable, nXBillable)

      

Call SqlCursorEx(csr_Customer, LEVEL0, "csr_Customer", "Customer", "Customer")       

Call SqlCursorEx(csr_XBillable, LEVEL1, "csr_XBillable", "XBillable", "XBillable")

       

Call ScreenInit()

        mh_xBillable = DetailSetup(csr_XBillable, SafGrid1, bXBillable.LineNbr, bXBillable, PNULL, PNULL, PNULL)

   

End Sub

 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to cast object of type 'System.String' to type 'System.IntPtr'

    The error id gone after I used

    bXBillable.AddressOf("LineNbr")

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans