Hi Friends,

I am having an issue with the login form for our application. Its a windows app, developed in VB.net

When the app loads, from the main form, a login screen is invoked, but the issue is , login screen looks like its having focus and the user id text box is having cursor as well. But when user starts typing stuff, there is no response. User has to click on the form, to get it activated and then start typing the user id.

here is the piece of code. the show form method is called, which calls ShowDialog.

Public Sub ShowForm()
            If Me.DialogResult = DialogResult.OK Then
                Me.UserID = txtUserID.Text
                Me.Password = txtPassword.Text
                Me.NewPassword = txtNewPassword.Text
                Dim sLogonType As LogonType = CType(cboType.SelectedItem, Pmi.LogonService.LogonType)
                Me.UserLogonType = sLogonType.Id
            End If
        End Sub

I tried the following things and it did not work.
- tried settign the form as Top, still no focus
- tried calling me.activate before and after showdialog, no focus
- tried calling me.select
- tried calling txtuserid.focus and txtuserid.select after show dialog
- handled activated and visible events and put some focus logic in that, still no focus.
Even worse is, before starting the aplication, if I minimise all the windows by pressing windows start button + D, and then open the application, it shows minimized.

But, if I open the application without pressing this key combination for minimize all windows, then form loads fine and displays fine, but no focus on the form, eventhough the text box is visibly having the cursor.

This error happens, when the application is deployed using an MSI, I tried in the developement environment and it works fine. the login form opens fine with focus in the text field and user can start typing directly

Appreciate your help.


Welcome to daniweb John! Please use code tags when posting code:

Can you upload a sample application demonstrating this behavior? You could also try adding this to the forms load event:

Private Sub frmSpawn_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If (Me.WindowState = FormWindowState.Minimized) Then
            Me.WindowState = FormWindowState.Normal
        End If
    End Sub