Hi i have a form1 and form2 and also a button1

in my button1 i have this code

Form2.show

now when the Form2 is show and everytime i click a button

    Private Sub Combo_AM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)_
    Handles Combo_AM.SelectedIndexChanged

    With Combo_AM

        If Combo_EBU.Text = "EBU 2" Then

            If .Text = TonetteA Then
                EBU2_TonetteA()
                AMFormat()
            ElseIf .Text = JennyT Then
                EBU2_JenniferT()
                AMFormat()
            ElseIf .Text = MaricrisB Then
                EBU2_MaricrisB()
                AMFormat()
            ElseIf .Text = NellieR Then
                EBU2_NellieR()
                AMFormat()
            End If
     ......

the Form2 lost its focus
is their a way to do this stuff?
like i put something like

Form2.focus

if there is any control on form2 , you can just set focus to that control on the load event of your form 2. like

me.comboBox1.focus()

Hope this helps you.

...now when the Form2 is show and everytime i click a button the Form2 lost its focus

I have to ask, which Form parents the buttons that you are clicking? If they are on Form1, this is normal as they have to be in focus to be clicked.

Also, does the combobox handler code you posted have any relavence?
Is it on Form1 or Form2?

Try setting the window parent of form2.

'Place a statement to check and launch.
'The check is to safeguard from InvalidOperation Exceptions.

If Form2.Visible = False Then Form2.Show(Me)

'A simple call like:
Form2.TextBox1.Focus()
'Will then focus the control desired.

Edited 3 Years Ago by Begginnerdev

This article has been dead for over six months. Start a new discussion instead.