stordaz Posted April 29, 2003 Posted April 29, 2003 Hi, is it possible to call an event in another form? I mean: from Form1 may I execute a Form2_Activated? Thx Quote
*Experts* Nerseus Posted April 29, 2003 *Experts* Posted April 29, 2003 Do you really want to Activate the other form, or just run the code in that event? -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
*Experts* Nerseus Posted April 29, 2003 *Experts* Posted April 29, 2003 Well, you could mark the function as public so that another form could see the function. Remember that events are really just functions that are hooked up to get called automatically by windows. But you can still change the "private" word to "public". If it were me, I'd put the code that's currently in your activate event into a separate function. I'd then have the activate event call this function. This function could be marked as public and this function is the one I'd call from the other form. It strikes me as odd that the code you want to run when the form is activated needs to be run from another form... Regardless of how you declare the function, you're going to also need a reference to the form. I'm not sure of how things are setup, but that might be an issue if you're trying to use the class name as the reference (as you could do in VB6). If that's the case, just ask and we can answer. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
stordaz Posted April 29, 2003 Author Posted April 29, 2003 In fact it's odd... I was just trying to try to find a way to run the code written in the Activate Event of another form without calling a global subroutine, leaving the Activate code as it was. There was a bug I wasn't able to find it and that was just a way to discover it. Now I've found it and solved it. Thank you for replying to such an odd question! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.