Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i am having some trouble transitioning a few things with C++ from vb, in vb, i could easily grab the text value from a button's sender property by declaring a variable as a control and grabbing it from there

 

Dim c as Control = sender

Dim s as string = c.text

 

walla, however, obviously not so easy in C++, it gives me a cannot covert object -> control...anyone know exactly how to go about doing this?

  • Leaders
Posted (edited)

Wouldn't we be dealing with pointers or handles in C++ (depending on the version)? I'd think it would be something more like this:

// 7
Control* c = (Control*) sender;
System::String* text = c->Text;
//or
System::String* text = ((Control*)sender)->Text;

// 8
Control^ c = (Control^) sender;
System::String^ text = c->Text;
//or
System::String^ text = ((Control^)sender)->Text;

Edited by snarfblam
[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...