Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2004, 01:44 PM
Authorized User
 
Join Date: Jul 2003
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form events

Hi.
Could anyone tell me what event to use after I change .Visible from False to True? I need to trigger my function every time Form is visible.

Thank you.
Pavel

 
Old April 19th, 2004, 03:57 PM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

CAN YOU BE MORE SPECIFIC AS TO WHAT IT IS YOU WANT TO DO

 
Old April 20th, 2004, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

VB forms do not expose a OnVisible event (as well as many others we wish it had). You have two choice, as far as I know: subclass you form and find the right event, or just put a timer (half a seconds or so should be enough) that checks when the me.visible changes. Remember to enable the timer in the Load event and disable it in the unload. You can find good subclassing components at a reasonable price, chip ones so so, and very bad for free. If the application is simple and you feel to have enough time, you can also roll your own.
Marco
 
Old April 22nd, 2004, 07:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

There is no ON VISIBLE event in Access, so what you have to do is at the time you actually change the visible property of the control, then you ALSO run the code you want. For example, let's say you have a textbox and you want a button to be visible if the textbox is not null, You would put this on the textbox's AFTER UPDATE event:

Code:
Me.cmdMyButton.Visible = Not IsNull(Me.txtMyTextBox)
But then you want some other code to happen for the button, but there's no ON VISIBLE event for the button. You'll have to take care of it at the textbox's AFTER UPDATE event along with making the button visible/invisible:

Code:
If IsNull(Me.txtMyTextBox) Then
   Me.cmdMyButton.Visible = False
   'Run some other code here
Else
   Me.cmdMyButton.Visible = True
   'Run some other code here
End If

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
"Delete Events" in Form Do Not Execute tcarnahan Access VBA 3 November 12th, 2003 10:06 PM
help with Events egiblock JSP Basics 0 October 6th, 2003 11:39 PM
capturing form closed events alexferrie C# 2 June 17th, 2003 10:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.