Cannot convert from unsigned short to unsigned short?????

B

Bo Berglund

I am trying to port code from Delphi to C++ as described in a previous
post titled: "How to swap bytes in variables (VS2005)???"

Now I have run into a bit of a snag due to my ignorance of C++, no
doubt....
The VS2005 compiler outputs this error:

1>c:\engineering\vs2005\vstest32\vstest32\MainForm.h(119) : error
C2143: syntax error : missing ';' before '.'

And doubleclicking it brings me here:

private: System::Void btnInit_Click(System::Object^ sender,
System::EventArgs^ e) {
MainForm.lblInit.Text = "Start";

What I am trying to do is to put the text "Start" into a lable lblInit
on the form MainForm. If I remove MainForm. from the code then the
error becomes this instead:

1>c:\engineering\vs2005\vstest32\vstest32\MainForm.h(118) : error
C2228: left of '.Text' must have class/struct/union
1> type is 'System::Windows::Forms::Label ^'
1> did you intend to use '->' instead?

And I have no clue as to what this means. In VisualBasic as well as in
Delphi you specify the properties with dot notation and enter values
by assignment. Is this not possible in C++??

What does the reference to -> mean? Is this what I should do and if so
how?

Completely new to C++ as you can see....
Have programmed ANSI C for many years a long time ago though.

TIA


Bo Berglund
bo.berglund(at)nospam.telia.com
 
B

Bo Berglund

Sorry about the misleading subject. I had started posting such a
question but I found that the reason was that function calls in C++
apparently need the () even though the function does not take any
arguments. This fixed that problem, but then I just changed the
contents of the question without thinking about the subject....

I guess I have to repost with a better subject.


Bo Berglund
bo.berglund(at)nospam.telia.com
 
B

Ben Voigt

Bo Berglund said:
Sorry about the misleading subject. I had started posting such a
question but I found that the reason was that function calls in C++
apparently need the () even though the function does not take any
arguments. This fixed that problem, but then I just changed the
contents of the question without thinking about the subject....

That's true, you'll usually see a message like "can't convert from method
group to XYZ" when you forget.

Will answer your original question in your repost.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top