Results 1 to 5 of 5

Thread: Loading forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    66
    In my frmMain, I want to show another form on top of the frmMain

    At the very end of my frmMain_Load code I have put

    frmVote.show vbmodal

    but it only shows the frmvote form until it's closed - then the frmMain is shown.

    If I use frmvote.show then the frmMain hides the frmvote?/

    Help!!!

    Simon

  2. #2
    Guest
    Just before you make the second form visible, expose your first form by "showing" it as well.
    So put this in your frmMain_Load event:

    Me.show
    frmVote.show vbmodal

    This will make sure that the main form is visible before it loads the second.

    Imar



  3. #3
    Guest
    Hello SimonPearce,

    Try using something like the following:

    code

    Private Sub Form_Load()

    frmMain.Visible = True

    ' bla bla bla
    ' bla bla bla
    ' bla bla bla
    ' bla bla bla
    ' bla bla bla
    ' bla bla bla

    frmVote.Show 1, Me

    End Sub

    /code

    Hope this helps,

    Roger

  4. #4
    Member
    Join Date
    Aug 1999
    Location
    Houston
    Posts
    48
    Below are Windows API calls from VB that tell Windows which forms you want on top.


    'put these lines in a MODULE (a .bas file)

    Public Const HWND_TOPMOST = -1
    Public Const HWND_NOTOPMOST = -2
    Declare Function SetWindowPos Lib "USER32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long


    'in a command button or form, put the following lines

    'this puts Form1 on top of what's on the screen
    success% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)


    'this line removes Form1 from the screen
    success% = SetWindowPos(Form1.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, flags)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    UK
    Posts
    66
    That did it great!

    Thanks everyone.

    Simon


    Just before you make the second form visible, expose your first form by "showing" it as well.
    So put this in your frmMain_Load event:

    Me.show
    frmVote.show vbmodal

    This will make sure that the main form is visible before it loads the second.

    Imar




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