473,394 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

VB.net to C# conversion for late binding - please help

No one on any of the other boards seem to know

In VB.Net this late binding works fine
Dim Version As Integer
Dim Revision As Integer
Dim Wnum As Integer
Dim o As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim h As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim l As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim c As System.Array = System.Array.CreateInstance
(GetType(Single), 1)
Dim Vol As System.Array = System.Array.CreateInstance
(GetType(Int32), 1)
Dim Dates As System.Array = System.Array.CreateInstance
(GetType(Int32), 1)

t = CreateObject("TC2000Dev.cTC2000")

Wnum = 1000

Revision = t.GetRevision
Label1.Text() = Revision

t.GetPrices(Wnum, o, h, l, c, Vol, Dates, 100)

Label2.Text() = c(1)


When it is converted to C# late binding, the GetRevision
method works but the GetPrices does not

GetRevision only is suppose to return an Int32, but
GetPrices is supposed to return multiple System.Arrays

int WNum = 1000;

System.Array _open = new System.Single[1];
System.Array _high = new System.Single[1];
System.Array _low = new System.Single[1];
System.Array _close = new System.Single[1];
System.Array _vol = new System.Int32[1];
System.Array _date = new System.Int32[1];
object[] d = {WNum, _open, _high, _low, _close, _vol,
_date, day};
Type myType = Type.GetTypeFromProgID("TC2000Dev.cTC2000");
object myObject = Activator.CreateInstance(myType);
//Works
Int32 Revision = (Int32) myType.InvokeMember
("GetRevision",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{});

label1.Text = Revision.ToString();

//Does not work
d = (object[]) myType.InvokeMember("GetPrices",
BindingFlags.Default | BindingFlags.InvokeMethod,
null,
myObject,
new object[]{WNum, _open, _high, _low, _close, _vol,
_date, 100});
How does the InvokeMember need to change to allow the
GetPrices to work?

WNum and 100 are the input params, and _open, _high,
_low, _close, _vol, _date are system arrays that are
returned

Thanks

..
Nov 15 '05 #1
0 1129

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David | last post by:
Hi, I want to work with Access 2002. I will need to be able to distribute my application to users that may still have access 2000 on their computers. I know access 2002 has a function that...
7
by: PC Datasheet | last post by:
I have this: Dim Cbr As Object Dim Ctl As Object Set Cbr = Application.Commandbars("CourseCalendarMonth") Set Ctl = Application.Commandbars("CourseCalendarMonth").Controls("CalendarMonth") Is...
14
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
5
by: Daniel Bass | last post by:
..Net is great for modulerising libraries, so that all you need do to access a DLL, is simply call Add Reference and wallah, it's as though the library were written in your project. But what...
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
2
by: GS | last post by:
I have installed the ms PIA for ofc XP, and followed the article http://support.microsoft.com/kb/247412/ trying to paste into a worksheet However I got late binding not allowed errors .......
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
4
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, what is the difference between the late binding and reflection? clara -- thank you so much for your help
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.