I have a list and 2 textboxes:
when you select the list you get a name and a cost.
Then when you select and input a number in the price textbox I want to update the profit textbox, on the change event. The problem I get is that when I input the first number in the proce textbox it set focus on the profit textbox as I need to update it.
How can I do it to make it right?
Do you have code that sets focus to the profit textbox? If yes, I suggest you remove that.
Use the AfterUpdate event on your price textbox to perform the calculation. For the type of scenario you are describing, the AfterUpdate event for the control is almost always preferred over other events such as Change, GotFocus, LostFocus, Enter, Exit or Click.
One of the only places you need to use the change event is when you want to perform a search/filter while the person is typing. At first this seems like a wise idea but as the database grows in size/records it usually causes performance issues. Once again, the AfterUpdate event is almost always the event you want to use to perform calculations or apply filters.