473,765 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cr eateInstance
(GetType(Single ), 1)
Dim h As System.Array = System.Array.Cr eateInstance
(GetType(Single ), 1)
Dim l As System.Array = System.Array.Cr eateInstance
(GetType(Single ), 1)
Dim c As System.Array = System.Array.Cr eateInstance
(GetType(Single ), 1)
Dim Vol As System.Array = System.Array.Cr eateInstance
(GetType(Int32) , 1)
Dim Dates As System.Array = System.Array.Cr eateInstance
(GetType(Int32) , 1)

t = CreateObject("T C2000Dev.cTC200 0")

Wnum = 1000

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

t.GetPrices(Wnu m, 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.GetTypeFro mProgID("TC2000 Dev.cTC2000");
object myObject = Activator.Creat eInstance(myTyp e);
//Works
Int32 Revision = (Int32) myType.InvokeMe mber
("GetRevisio n",
BindingFlags.De fault | BindingFlags.In vokeMethod,
null,
myObject,
new object[]{});

label1.Text = Revision.ToStri ng();

//Does not work
d = (object[]) myType.InvokeMe mber("GetPrices ",
BindingFlags.De fault | BindingFlags.In vokeMethod,
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 1159

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

Similar topics

4
2304
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 enables you to convert a database to a format of an earlier version of Access. I wanted to check for any unforeseen problems so here is what I did: I used Access 2002 to convert my Access 2000 application to the 2002
7
3043
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 this considered late binding? If not, what needs changed? Thanks!
14
4312
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 hundreds of lines of code to format a Word document in a very specific way. Because my clients have various versions of Word, the problem of broken references comes up. I wish Microsoft had implemented a reasonable solution, so that VBA could do...
9
10427
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 As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
5
1556
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 happens when i know that a library must have some method, say void StoreXML ( string XMLmsg ) but want to late bind, as in, only at run time, decide which library i wish to use.
30
2834
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 integer The integers in these arrays are actually pointers to different columns of data in a text file.
2
8348
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 .... webOCWraooer,Copy // get the desired data into clapboard
14
2041
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 binding", I am struggling to understand why I am tripping this error. This is the code that causes the problems: XLApp.Goto("MonthTitleTL") 'Goes to bookmark in sheet r = XLApp.ActiveCell.Row 'sets variable r equal
4
2614
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
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.