User Control's RaiseEvent is crashing VB 
Author Message
 User Control's RaiseEvent is crashing VB

Greetings...
First, If I'd be better served by posting this elsewhere, just hollar.

Basically, I'm wrapping a VB combobox inside of a user control and
exposing all of the combobox's props/methods/events using the user
control.

The problem that I'm running into (and this seems to stem from
my limited knowledge of user controls) is when adding events to
the user control that correspond to the combobox event, VB is
crashing when we run the code and do something that fires the
combobox event in question.  (I'm testing this w/ a stripped down
vb project that does absolutely nothing but reproduce this behavior)

I can post sample code that does this; I'm creating the user
control right inside the vbp (I'm not using a compiled OCX)

Right now, it's the Validate event that is crashing VB, but
that can change if I create a brand new project and start over.
(meaning, I can create a brand new project, add the user control
and put the combobox inside of it and start adding the corresponding
props/methods/events and at some (seemingly random, although I'm
guessing otherwise) point, all of a sudden some event that -was-
working/firing ok, now crashes on the line in the user control
"RaiseEvent Validate" (or LostFocus, or whatever event starts acting
up).  And from this point on, no matter what I do, that event will
crash VB...  Again, I can start from scratch and create a brand new
project, and have all events working, but something I do causes some
event to start crashing VB.  (Except all I'm doing is adding more
code to the user control, so I'm not sure what the heck I'm doing
wrong).

I'm hoping somebody can shed some light on the error of my ways.
Any suggestions are much appreciated.
Thanks

Michael



Fri, 11 Mar 2005 22:43:40 GMT  
 User Control's RaiseEvent is crashing VB
Michael...

Quote:
> "RaiseEvent Validate" (or LostFocus, or whatever event starts acting
> up).

You should not be creating or raising these events - VB does that work for
you. Start a new VB project (standard EXE), add a UserControl, then without
adding any code to the UserControl, add an instance of it to the form and
open up its code window. Notice that events such as Validate and LostFocus
already exist, and will be automatically raised at the appropriate time.

--
Ben Baird
Visual Basic Thunder
http://www.vbthunder.com



Sat, 12 Mar 2005 06:06:42 GMT  
 User Control's RaiseEvent is crashing VB


Quote:
> Michael...

>> "RaiseEvent Validate" (or LostFocus, or whatever event starts acting
>> up).

> You should not be creating or raising these events - VB does that work
> for you. Start a new VB project (standard EXE), add a UserControl,
> then without adding any code to the UserControl, add an instance of it
> to the form and open up its code window. Notice that events such as
> Validate and LostFocus already exist, and will be automatically raised
> at the appropriate time.

Thanks for the response Ben!  This was exactly my problem, apparently!
It didn't hit me that doing the RaiseEvent w/ an event that VB was
raising for me would crash me.
VERY much appreciated, thanks again Ben.

Michael



Sat, 12 Mar 2005 06:28:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to RaiseEvent in user control from form?

2. Bug in vb's "raiseevent"

3. Custom VB Control RaiseEvent Problem

4. Tip : VB.NET Form Won't Close on Me.Close + User Controls

5. raiseevent doesn't

6. Windowless UserControl can't RaiseEvent???

7. Windowless UserControls can't RaiseEvent???

8. RaiseEvent doesn't seem to work when using AddressOf function

9. I am trying to update a record, i am not using data control

10. Bizarre VB Crash related to User Defined Types

11. help: I' am new to VB

12. I am trying to update a record, i am not using data control

 

 
Powered by phpBB® Forum Software