Results 1 to 3 of 3

Thread: tab and form load issue

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Posts
    90

    Resolved tab and form load issue

    hi,
    i've a form that has two textboxes and i want that after i've typed stuff in the first textbox and i hit tab, it shud go to the second textbox....to do this all i've done is set tabindex to 0and 1 for the 2 textboxes and tabStop is true

    also i've two forms that load up when the program runs, but i want this login form to load up first so how do i do that...i tried to make frm2.visible=false in the formLoad() function of the frm1, but it didnt' work
    Last edited by liteuponlite; Aug 13th, 2005 at 09:00 PM.

  2. #2

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: tab and form load issue

    Something like this, I think.
    VB Code:
    1. Option Explicit
    2. ' in Form2
    3.  
    4. Private Sub cmdLogin_Click()
    5.   user = Text1.Text
    6.   pass = Text2.Text
    7.   Unload Me
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11.   Text1.Text = ""
    12.   Text2.Text = ""
    13. End Sub
    14.  
    15. Private Sub Text1_KeyPress(KeyAscii As Integer)
    16.   If KeyAscii = Asc(vbTab) Then
    17.     Text2.SetFocus
    18.   End If
    19. End Sub

    and
    VB Code:
    1. Option Explicit
    2. ' in module1.bas
    3. ' make sure you go to project properties and set startup to sub Main
    4. Public user$, pass$
    5.  
    6. Sub Main()
    7.   Form2.Show vbModal
    8.   If user = "user" And pass = "pass" Then
    9.     Form1.Show
    10.   Else
    11.     MsgBox "Incorrect Login"
    12.   End If
    13. End Sub

    form1 will get called only if the user supplies the correct information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width