i have two textbox's... these textbox's can have formatting applied etc, but they lose focus when a button is pressed, and the wrong textbox has formatting applied..

is there a way to track the last textbox to have control?.

some kind of for each control f type textbox, if mouse.click, this.textbox.focus = true?

i've seen examples on the net, but they didnt work for me.

any help is appriciated..

thanks.

Recommended Answers

All 3 Replies

try

this.textbox.focus();

When a button is pressed, the focus will be moving on to button,
you can do this,
once the operation on button_click is done, before the event exits, based on your logic call the last line for either textbox1.focus(); or textbox2.focus();
this should be a simple option.

solved. i just added a variable textboxfocus. then in the Enter event of each textbox i set it to true or false accordignly.

textbox1_enter( bla bla)
{
textboxfocus1 = true;
textboxfocus2 = false;
etc..
}

then in my bold, itallics section, i just use if statements to calculate which textbox last had focus.

may not be perfect, but it works.

thanks guys.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.