Hello, just wondering if there is another event i can use for when you are done writing to the textbox
the normal textchanged event goes in play everytime you change a letter.
i need the event to go in play when im done writing and for example start writing in the next one?
is there an event that knows where my textmarker is?

Thank you for answers :)
Dendei:

Recommended Answers

All 5 Replies

You could use one of the Key events, and perhaps do something like this:

private void textBox1_TextChanged(object sender, EventArgs e)
        {
            //Your stuff here
        }

        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter) 
            { 
                // if it is the enter key, select the next textbox
                textBox2.Select(); 
            }
        }

I guess something like that will work but it will require the enter press :/ so then I have to explain that to new users and stuff that they have to press it before going on to next.
I'll be a little cautious and wait and search some more :) but it is certainly an solution

There's also the Leave event; it's fired when the TextBox loses focus. Just keep in mind, that if you have an AcceptButton set and the user presses <Enter>, the Button.Click event will fire, but the Leave event will not (since it never really loses focus).

You may want to even look at the validation logic that WinForms supports. You can individually validate each control in the Leave event, and also call ValidateChildren on the Form to validate all controls in the Button.Click event. Not sure if this applies in your situation, but just an idea.

The normal action would be to press the tab key to set the focus on the next textbox, depending on the tabindex property you set.

hmm interesting fould event Leave that will do the job perfectly when i leave the textbox input i'll check if it is taken not everytime i change a letter :)

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.