Click to See Complete Forum and Search --> : Error message regarding pointer


Randomman159
March 15th, 2010, 02:19 AM
Hi, i am making a form in visual C++ express edition...
I have these lines in my code:

int * SubTab;
SubTab = &this->tabControl2->SelectedIndex;

And I am getting this error message:


- '&' requires l-value

how can i do this?

Basically, i want to be able to change the value of this->tabControl2->SelectedIndex through the pointer. I want to be able to also change which tabcontrol is being changed. For example, later in my code i have:

SubTab = &this->tabControl3->SelectedIndex;

so the tabcontrol should change... however, it is not allowing this type of information


thanks

cilu
March 18th, 2010, 02:47 AM
Try this:

SubTab = &(this->tabControl2->SelectedIndex);