PC Review


Reply
Thread Tools Rate Thread

Cancelling event in event procedure

 
 
=?Utf-8?B?QWRpbCBBa3JhbQ==?=
Guest
Posts: n/a
 
      22nd Aug 2005
I want to cancel an event from its event procedure on some condition, I know
how to do this in VB6 i.e. by setting cancel=true. Please tell me how can I
do this in VB.net I don't know how to use the eventArgs in VB.net and neither
its help is available in MSDN.

I'm thank full to you in advance.
 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      22nd Aug 2005
Adil,

It depends on the event. However have a look at the eventarguments if it is
possible than it is normally

e.cancel = true or false.

I hope this helps,

Cor


 
Reply With Quote
 
=?Utf-8?B?QWRpbCBBa3JhbQ==?=
Guest
Posts: n/a
 
      22nd Aug 2005
Thanks for you reply but it didn't solve the problem, I actually want to
cancel the form's Load event. What I want to do is, To stop loading form on
some condition.

Please tell me if this is possible, or if there's any alternative solution
to this problem.

"Cor Ligthert [MVP]" wrote:

> Adil,
>
> It depends on the event. However have a look at the eventarguments if it is
> possible than it is normally
>
> e.cancel = true or false.
>
> I hope this helps,
>
> Cor
>
>
>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      22nd Aug 2005
Adil,

> Thanks for you reply but it didn't solve the problem, I actually want to
> cancel the form's Load event. What I want to do is, To stop loading form
> on
> some condition.


In the forms load event you can simple place.
me.close

I hope this helps,

Cor


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      22nd Aug 2005
"Adil Akram" <(E-Mail Removed)> schrieb
> Thanks for you reply but it didn't solve the problem, I actually
> want to cancel the form's Load event. What I want to do is, To stop
> loading form on some condition.
>
> Please tell me if this is possible, or if there's any alternative
> solution to this problem.



Don't show the form if you're not going to show it.


Armin
 
Reply With Quote
 
=?Utf-8?B?QWRpbCBBa3JhbQ==?=
Guest
Posts: n/a
 
      22nd Aug 2005
I've already tried me.close but it comes up with following error

"Additional information: Cannot call Close() while doing CreateHandle()."

"Cor Ligthert [MVP]" wrote:

> Adil,
>
> > Thanks for you reply but it didn't solve the problem, I actually want to
> > cancel the form's Load event. What I want to do is, To stop loading form
> > on
> > some condition.

>
> In the forms load event you can simple place.
> me.close
>
> I hope this helps,
>
> Cor
>
>
>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      22nd Aug 2005
Adil,

> I've already tried me.close but it comes up with following error
>

Your question is Cancellin an event in a event procedure.

I think that it is completly answered.

If you have another problem, than ask that direct, that saves others time.

Just my thought,

Cor


 
Reply With Quote
 
=?Utf-8?B?QWRpbCBBa3JhbQ==?=
Guest
Posts: n/a
 
      22nd Aug 2005
Cor,
As u suggested to correspond privately, tell me your email address. I've
sent mail at your address "(E-Mail Removed)" but its bounced back.

As told, In load event I tried to close the form but it comes with error
"Additional information: Cannot call Close() while doing CreateHandle()."

I've also tried to call me.Dispose() in constructor but the show method form
caller gives error because object destroyed before show method called.

I've also tried to do this in HandleCreated event but the same error

Please tell me if there's any other event before or after load event that I
can
use safely to cancel form loading, or if u have any other better idea to
tackle this situation please tell me that.


"Cor Ligthert [MVP]" wrote:

> Adil,
>
> > I've already tried me.close but it comes up with following error
> >

> Your question is Cancellin an event in a event procedure.
>
> I think that it is completly answered.
>
> If you have another problem, than ask that direct, that saves others time.
>
> Just my thought,
>
> Cor
>
>
>

 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      22nd Aug 2005
Adil,

The form class has in fact only one purpose: Showing a form.

Therefore if you don't want to show it use another class to decide if you
want to show it. By instance Armin, Herfried and others use a seperated
module main to start it from.

The best way to get some help in my opinion is to show *some* code by
instance as you have it now in your load form class. Than we maybe
understand what you want to do.

Or even better, explain as well what is the purpose to get that handle.

Cor


"Adil Akram" <(E-Mail Removed)> schreef in bericht
news:2E368599-181E-4048-9714-(E-Mail Removed)...
> Cor,
> As u suggested to correspond privately, tell me your email address. I've
> sent mail at your address "(E-Mail Removed)" but its bounced back.
>
> As told, In load event I tried to close the form but it comes with error
> "Additional information: Cannot call Close() while doing CreateHandle()."
>
> I've also tried to call me.Dispose() in constructor but the show method
> form
> caller gives error because object destroyed before show method called.
>
> I've also tried to do this in HandleCreated event but the same error
>
> Please tell me if there's any other event before or after load event that
> I
> can
> use safely to cancel form loading, or if u have any other better idea to
> tackle this situation please tell me that.
>
>
> "Cor Ligthert [MVP]" wrote:
>
>> Adil,
>>
>> > I've already tried me.close but it comes up with following error
>> >

>> Your question is Cancellin an event in a event procedure.
>>
>> I think that it is completly answered.
>>
>> If you have another problem, than ask that direct, that saves others
>> time.
>>
>> Just my thought,
>>
>> Cor
>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?QWRpbCBBa3JhbQ==?=
Guest
Posts: n/a
 
      22nd Aug 2005
Armin
Actually I want to prevent opening form if its already opened. I can do this
by writing code at caller but I want some generic code that works for all
forms to prevent a form opening twice.



"Armin Zingler" wrote:

> "Adil Akram" <(E-Mail Removed)> schrieb
> > Thanks for you reply but it didn't solve the problem, I actually
> > want to cancel the form's Load event. What I want to do is, To stop
> > loading form on some condition.
> >
> > Please tell me if this is possible, or if there's any alternative
> > solution to this problem.

>
>
> Don't show the form if you're not going to show it.
>
>
> Armin
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a Event Procedure and Macro in the Before Update Event Frank Microsoft Access Form Coding 5 12th Jan 2008 12:50 AM
Call subform event procedure from main form event procedure ? =?Utf-8?B?cGxj?= Microsoft Access Form Coding 2 26th Oct 2006 10:15 PM
Cancelling a Before Update event =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= Microsoft Access Form Coding 2 14th Sep 2006 11:50 PM
cancelling a control event in another procedure =?Utf-8?B?Q2hyaXM=?= Microsoft Dot NET Framework 0 25th Feb 2005 09:49 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Microsoft Excel Programming 0 24th Sep 2003 03:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:49 AM.