[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

MSForms problem...

I want to create a simple Frame with CommandButtons. The problem is that the Frame always appears in front of the Buttons. How can I get it to stay behind like the standard Frame?

Thanks,
Tim
0
tim8w
Asked:
tim8w
  • 4
  • 2
1 Solution
 
vb_elmarCommented:
In the VB IDE, (when the form is visible) klick on the buttons (while holding Strg down)

2. now press Strg-X

3. click on the Frame

4. now press Strg-V (the buttons are on the Frame now)

When starting the programm, the buttons appear in front of the frame.
0
 
tim8wAuthor Commented:
vb_elmar ,
That works fine for the standard Frame and CommandButtons, but not for MSForms. I select the MSForms button, cut it, select the MSForms Frame, right click and select paste. It places the button in the upper-right corner of the form, just like if I hadn't selected the Frame at all...

Tim
0
 
vb_elmarCommented:
..hmmmm
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
2AngelCommented:
Why don't you use: right click the frame and then select "Send To Back"?
0
 
vb_elmarCommented:
>>>Why don't you use: right click the frame and then select "Send To Back"?
@ 2Angel
"Send To Back" does not work - i checked it. -When starting VB, the frame isn't in the background, no matter what i do.
(the controls are fom --->  Microsoft Forms 2.0 Object Library)

@ tim8w
-Try this (working with that code brings the MSForms-Frame to the background and the 2 buttons to the foreground ) :

'Needs 2 MsForms-CommandButtons and 1 MsForms-Frame
Private Sub Form_Activate()
Frame1.ZOrder (1)
Frame1.TabStop = False
CommandButton1.SetFocus
MsgBox "Please  hit   TAB   now."
End Sub
0
 
tim8wAuthor Commented:
vb_elmar,

Didn't work. I tried the following:

    OptionButton1.ZOrder fmTop
    OptionButton2.ZOrder fmTop
    OptionButton3.ZOrder fmTop
    Frame1.ZOrder fmBottom
    Frame1.TabStop = False
    OptionButton1.Value = True

Is there any other Component combination that will give me transparent backgrounds for OptionButtons AND Frames?

Thanks,
Tim
0
 
vb_elmarCommented:
tim8w,

Only when VB is running, and Form1_Activate and "Doevents" is done,
the MSForms controls accept  
commands like ZOrder(0) or ZOrder (1).

The constants "fmTop" and "fmBottom" are unknown to VB. -Therefore
VB has to learn the 2 constants first (VB6).

-The sample below will send the frame to back and
bring the three option buttons to top.

Private Sub Form_Activate()
Me.Move 0, 0
Me.BackColor = vbBlue
Frame1.BackColor = vbGreen
DoEvents

Dim fmBottom As Integer, fmTop As Integer
fmTop = 0: fmBottom = 1

MsgBox "Hit me ."
OptionButton1.ZOrder fmTop
MsgBox "Hit me ."
OptionButton2.ZOrder fmTop
MsgBox "Hit me ."
OptionButton3.ZOrder fmTop

Frame1.ZOrder fmBottom
Frame1.TabStop = False
Frame1.Enabled = False
MsgBox "Hit me ."
OptionButton1.Value = True
End Sub
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now