|
-
Apr 15th, 2000, 05:20 AM
#1
Thread Starter
Lively Member
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
-
Apr 15th, 2000, 05:38 AM
#2
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
-
Apr 15th, 2000, 05:38 AM
#3
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
-
Apr 15th, 2000, 06:23 AM
#4
Member
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)
-
Apr 15th, 2000, 04:14 PM
#5
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|