get sender value

inighthawki

Newcomer
Joined
Nov 29, 2005
Messages
14
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?
 
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:
C#:
// 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;
 
Last edited:
ah ok thx marble eater, i found a thread b4 with something like what PlausiblyDamp wrote, but it didn't work, that ^ after the Control was the trick to it working.
 
Back
Top