message box pop up problems

R

RipperT

Problem 1: I am attempting to get a message box (OKonly) to pop up when a
user clicks a certain tab of a tab control. Is this possible? It looks like
each tab of a tab control is not a control in itself.
Problem 2: I also would like another message box (OKonly) to pop up when a
form is opened, but no matter which event I attach it to (OnLoad, OnOpen,
etc..) the MsgBox opens first, then the form. How can I get the form to open
first, then the MsgBox immediately following?

TIA,

Ripper T
 
R

Rick Brandt

RipperT said:
Problem 1: I am attempting to get a message box (OKonly) to pop up
when a user clicks a certain tab of a tab control. Is this possible?
It looks like each tab of a tab control is not a control in itself.

Use the Change event of the entire TabControl and test its Value property to
determine which page was just selected. It will correspond to that page's index
property.

Problem 2: I also would like another message box (OKonly) to pop up
when a form is opened, but no matter which event I attach it to
(OnLoad, OnOpen, etc..) the MsgBox opens first, then the form. How
can I get the form to open first, then the MsgBox immediately
following?

Try issuing...

Me.Visible = True
and/or
Me.Repaint

....in the Form's Load event just prior to opening the MsgBox. Otherwise use the
Form's Timer event instead. To make it only run once use...

MsgBox "Whatever"
Me.TimerInterval = 0
 
R

RipperT

:


Use the Change event of the entire TabControl and test its Value property to
determine which page was just selected. It will correspond to that page's index
property.

How do I do this?

Thank you!

Rip
 
R

Rick Brandt

RipperT said:

Look at the {Events} tab of the property sheet while the TabControl is selected.
Enter "[Event Procedure]" (without the quotes) in the property box labeled
"Change", then press the build button [...] to the immediate right of that box.

You will be taken to the code editing window with your cursor automatically
positioned where your code needs to be typed in.

(example for a 3 page TabControl)

Select Case Me.TabControlName.Value
Case 0
'code to run if page 1 is selected
Case 1
'code to run if page 2 is selected
Case 2
'code to run if page 3 is selected
End Select
 
R

RipperT

Thanx for the help!

Rip

Rick Brandt said:
RipperT said:

Look at the {Events} tab of the property sheet while the TabControl is selected.
Enter "[Event Procedure]" (without the quotes) in the property box labeled
"Change", then press the build button [...] to the immediate right of that box.

You will be taken to the code editing window with your cursor automatically
positioned where your code needs to be typed in.

(example for a 3 page TabControl)

Select Case Me.TabControlName.Value
Case 0
'code to run if page 1 is selected
Case 1
'code to run if page 2 is selected
Case 2
'code to run if page 3 is selected
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top