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

How do I get a changed value back from C#

Hello!

Assume I have an C++.net function called loadPostNames see below.
loadPostNames( dialog->GetAllPostNames(index) );
This function loadPostNames have GetAllPostNames(index) as a parameter.
Function GetAllPostNames is a method in C#.

Now to my question this identifier index passed as a parameter to method
GetAllPostNames is changed in
C# I want to be able to get the new changed value back to the C++.Net
function..

I have tried several possibilitys but I get compile error.

How should I write?

//Tony
Jun 7 '06 #1
4 984
> Assume I have an C++.net function called loadPostNames see below.
loadPostNames( dialog->GetAllPostNames(index) );
This function loadPostNames have GetAllPostNames(index) as a parameter.
Function GetAllPostNames is a method in C#.

Now to my question this identifier index passed as a parameter to method
GetAllPostNames is changed in
C# I want to be able to get the new changed value back to the C++.Net
function..

I have tried several possibilitys but I get compile error.

How should I write?


You C# method that takes the int should use the ref keyword.
Method(ref int i);

Your C++ call does not have to change if you are using C++/CLI.
See here for an example:
http://www.winterdom.com/cppclifaq/archives/000421.html

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 7 '06 #2
Hello!!
I don't use C++/CLI I useVS2003 which is managed code.
This GetAllPostNames is an interface so I declared this GetAllPostNames in
this way
System::Collections::ArrayList* GetAllPostNames(ref int index);
and the C# method in this way public ArrayList GetAllPostNames(ref int
stdSopIndex)
This cause a compile error saying syntax error identifier ref.

If I instead declare the interface GetAllPostNames in this way
System::Collections::ArrayList* GetAllPostNames(int index);
and keep and the C# method in this way public ArrayList GetAllPostNames(ref
int stdSopIndex)
I get this compile error.
C:\PK\Development\Products\UTCAS\4.0\SRC\MeltPracA pplication\Dialog\ActionFo
rm.cs(16): 'MeltPracAppl.ActionForm' does not implement interface member
'MeltPracCommon.IMeltPracDialog.GetAllPostNames(in t)'

What is it that I don't do right?

Can you give me any hint about what I can do to make it work.

//Tony

"Bruno van Dooren" <br**********************@hotmail.com> skrev i
meddelandet news:#G**************@TK2MSFTNGP03.phx.gbl...
Assume I have an C++.net function called loadPostNames see below.
loadPostNames( dialog->GetAllPostNames(index) );
This function loadPostNames have GetAllPostNames(index) as a parameter.
Function GetAllPostNames is a method in C#.

Now to my question this identifier index passed as a parameter to method
GetAllPostNames is changed in
C# I want to be able to get the new changed value back to the C++.Net
function..

I have tried several possibilitys but I get compile error.

How should I write?


You C# method that takes the int should use the ref keyword.
Method(ref int i);

Your C++ call does not have to change if you are using C++/CLI.
See here for an example:
http://www.winterdom.com/cppclifaq/archives/000421.html

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"

Jun 7 '06 #3
> I don't use C++/CLI I useVS2003 which is managed code.
This GetAllPostNames is an interface so I declared this GetAllPostNames in
this way
System::Collections::ArrayList* GetAllPostNames(ref int index);
and the C# method in this way public ArrayList GetAllPostNames(ref int
stdSopIndex)
This cause a compile error saying syntax error identifier ref.


The C# code is ok. leave it like that.
The C++ code is wrong. there is no ref keyword in MC++
I have not used MC++ very much, but I think you need to do this:
GetAllPostNames(int & index);
Btw why did you need to declare the interface in C++?
if it is defined in the C# class lib, there should be no need to declare it
somewhere else I think.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 7 '06 #4
> I don't use C++/CLI I useVS2003 which is managed code.
This GetAllPostNames is an interface so I declared this GetAllPostNames in
this way
System::Collections::ArrayList* GetAllPostNames(ref int index);
and the C# method in this way public ArrayList GetAllPostNames(ref int
stdSopIndex)
This cause a compile error saying syntax error identifier ref.


The C# code is ok. leave it like that.
The C++ code is wrong. there is no ref keyword in MC++
I have not used MC++ very much, but I think you need to do this:
GetAllPostNames(int & index);
Btw why did you need to declare the interface in C++?
if it is defined in the C# class lib, there should be no need to declare it
somewhere else I think.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Jun 7 '06 #5

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

Similar topics

2
by: Bob Rivers | last post by:
Hi, Is it possible to verify, using js, if ANY item in a form has changed? For example: I have a <form> with multiple items (<input>, <select>, <textarea>, etc). I need to track if one (or...
2
by: Brennon Arnold | last post by:
I have a problem that I figured would be relatively common, but have been unable to find any information on it as of yet. I have a page that contains two DropDownList controls, with the second...
3
by: Tee | last post by:
Hi, I have few textboxes and combobox in a user control. How can I detect if a user has changed the value of combobox and the text in textbox? I know that textbox has a CanUndo property that...
3
by: Kyle Keller | last post by:
I created a database which my company has used for over 2 years at now over 30 locations. Just today, one of the locations called and was having problems with their program. The database is A97...
19
by: Taras_96 | last post by:
Hi everyone, How do you detect that a form element has been changed? This thread: ...
1
by: tony | last post by:
Hello! Assume I have an C++.net function called loadPostNames see below. loadPostNames( dialog->GetAllPostNames(index) ); This function loadPostNames have GetAllPostNames(index) as a parameter....
5
by: Mark | last post by:
Hello, I have a form where I want to only enable a save button when something has changed in the dataset. Currently I'm checking current values against original values everytime a value is...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
3
by: Bundy | last post by:
Hi How do I change the background colour of an input box in a form as soon as the value is changed? Also the background should revert back to it's original colour if the user decides that they...
2
by: Dan Sikorsky | last post by:
How can we tell if the value in a FormView EditItemTemplate TextBox has changed from its initial value so that we know if we have to update the corresponding db table column value? -- Thank you...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
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...

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.