You do not know.-The setfocus of the text box reports an error.

Source: Internet
Author: User
Most of the time, you need to focus on the text box, but in many cases, calling in the form load event is inevitable, which we can avoid, but if we avoid comparison in some cases, for example, calling the listindex attribute of combox triggers the click event. In most cases, we need to do some focus setting in this event.

All the click events of the combox affected by the load event cause the setfocus of the textbox to be sometimes incorrect, but sometimes it is normal. How can this problem be solved.

The solution is as follows:

Wrap the otext. setfouce method as the following code

'Set the focus of the text box
Public sub textboxsetfocus (otext as textbox)
If otext. Visible then otext. setfocus
End sub

You can use this function later.

The principle is very simple. It should be because textbox is invisible when setfocus is triggered in the load event, so when setfocus is called, process the textbox visibility.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.