473,326 Members | 2,134 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,326 software developers and data experts.

Passing parameter to an activeXControl

i have an activeXControl that have a function public virtual void GetCurrentUID(int)
this function only work when my program get an event from the machine.

my question, when i access this function in C#/.NET, the event always back from the start. this is my code :
int[] pUID = new int[7];
myMachine.GetCurrentUID(pUID[0]);


but, i try it in VB.NET and success, and i think this is really strange for me, i must passing this argument with reference. This function in object browser said like this Public Overridable Sub GetCurrentUID(ByVal pUID As Integer), and my code :

Dim bUID(6) As Byte
MyMachine.GetCurrentUID(VarPtrAny(bUID(0)))


VarPtrAny is a private function that i took in other forums, its written like this
Private Declare Function VarPtrAny Lib "msvbvm60.dll" Alias "VarPtr" (ByRef lpObject As Byte) As Integer

so, may you help me to convert this code from VB.NET to C#.NET? please, i need to make this program in C#.NET.
Jan 1 '08 #1
1 1370
Plater
7,872 Expert 4TB
This
Expand|Select|Wrap|Line Numbers
  1. Public Overridable Sub GetCurrentUID(ByVal pUID As Integer)
  2.  
does not return a value, so I'm not sure what the point of it is?

I would have expected it to be
Expand|Select|Wrap|Line Numbers
  1. Public Overridable Function GetCurrentUID() as Integer
  2.  
OR
Expand|Select|Wrap|Line Numbers
  1. Public Overridable Sub GetCurrentUID(ByRef pUID As Integer)
  2.  

So for C# you would use either:
Expand|Select|Wrap|Line Numbers
  1. GetCurrentUID(); //returns an int that is the UID
  2. //or
  3. GetCurrentUID(ref myint);//sets myint to be the UID
  4.  

If you could more clearly display the code you wish to convert to c# and what the actual errors are, I can probably help more.
Jan 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Poolguy | last post by:
I am having problems adding an activexcontrol to a usercontrol. I have an activexcontrol embedded in a usercontrol which is in a windows form within my application. When I exit the application, I...
0
by: Neo | last post by:
I have a control in an assembly that I am trying to display on a webpage as an ActiveXcontrol. However every time I tried to use the control I got a Security Exception. I found that REMOVING the...
6
by: wiredless | last post by:
What is the advantage of passing an interface type? according to UML (visio) when i reverse engineer existing code to a UML diagram I get the error "UMLE00046: sample : - An interface cannot...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
10
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication...
0
by: amazon | last post by:
I have web service that acceping following parameters.. postev.PostEvent(authentication as ws.authentication, name as string,id as string, exdate as date, parameter() as ws.nameparametervaluepair...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
12
by: dave_dp | last post by:
Hi, I have just started learning C++ language.. I've read much even tried to understand the way standard says but still can't get the grasp of that concept. When parameters are passed/returned...
4
by: Deckarep | last post by:
Hello fellow C# programmers, This question is more about general practice and convention so here goes: I got into a discussion with a co-worker who insisted that as a general practice all...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.