Deleguate setfocus method


I've a usercontrol on VB6 and I would like to know how to deleguate the setfocus method?

Thanks by advance.
Who is Participating?
ClifConnect With a Mentor Commented:
Oh, I see.  You want a control to have focus when the form is first displayed (but can't do it in the Form_Load() event, since the controls aren't visible during the load event).

You have two options

1. In design mode, set the TabIndex for the control to 0.  This will cause the control in question to acquire focus automatically when the form is loaded (no code required).

2. Although the Form_Load() event is not a valid place to set the focus of a control, you can put the code in the form's paint event (or even the Activate event).  You shoud set up a static variable so it only hits once (and not every time the form is repainted):

Private Sub Form_Paint()
    Static bSkip As Boolean
    If Not bSkip Then
    End If
End Sub
What do you mean by "deleguate" (delegate?)
esohierAuthor Commented:

I would like to give the method to the form to make this sample:

Sub Form _load


End Sub
esohierAuthor Commented:
Very thanks. That Ok.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.