|
-
May 9th, 2012, 10:12 AM
#1
SafeArray problem
New to VB.Net. Trying to port old code from VB6.
Public CHandles() As Long
Public SHandles() As Long
Public rerrors() As Long
Public itemvalues() As Object
Dim Str() As String
Once number of items is known:
ReDim SHandles(0 To itemcount)
ReDim rerrors(0 To itemcount)
ReDim CHandles(0 To itemcount)
ReDim Str(0 To itemcount)
In VB6, these were 1 to itemcount but VB.Net doesn't like this.
Now the following line:
g.OPCItems.AddItems(itemcount, Str, SHandles, CHandles, rerrors)
Generates a SafeArrayTypeMismatchException was unhandled.
Specified Array was not of the expected type error.
I assume it means the SHandles, rerrors, and CHandles arrays but not sure.
Tried to review and understand previous posts related to this problem but I cannot see my way through.
I am a EE with some programming experience. I am not an expert so please respond speaking slowly and using small words. 
Thanks for any help you can provide.
Tom
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|