TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Daniel Bruchez
NA
1
0
Specified cast is not valid
Mar 2 2007 4:12 PM
Trying to call a legacy VB6 control and get the following error at runtime. Code compiles clean. An unhandled exception of type 'System.InvalidCastException' occurred in TestPredict.exe Additional information: Specified cast is not valid. Code ---> VB6 Active X Public Function GetConcentration(ByRef Values As Variant, ByRef Size As Long) Dim tValues() As Double If fPredict = True Then Size = dGetItemSize(hCal, "concentration") If Size = 0 Then GetConcentration = -3 'if value not available Else ReDim tValues(1 To Size) GetConcentration = dCopyItem(hCal, tValues(1), "concentration", Size) GetConcentration = 0 'success Values = tValues End If Else GetConcentration = -2 'if prediction not available End If End Function C# call ---> object fValues = new double(); err = IQPredict.GetConcforCSharp(ref fValues, ref size); errlabel.Text = Convert.ToString(err); double[] fval = new double[size]; fval[0] = ((double[])fValues)[0];
Reply
Answers (
0
)
how to get info about an ip address
C# Telnet into PLC-Motion Controller