Selecting an event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm new to .NET, though program with VB. I'm used to selecting an event from
the right side drop down box of the VB IDE. That seems to have changed with
..NET. How do you choose an event, say for example, the click event of a form
object so as to write a method for that event.

Thanks for your help on this
Regards
Ant
 
1 - Just double click on The object. For example, Draw the button and then
double click on it. That would take u to the button_click event.

2- the click event would be by default, if you want a double click event
then , draw button first, then when ur in code view. Choose button in class
name on top, and then choose the event u want.
 
Hi mario,
Thanks for that, however It's still no clearer. I understand how i can get
to the default event, that is, by clicking on the control, but how do i get
to all the other events such as, i don't know, say, LostFocus or MouseDown,
or KeyUp. Once I'm in the 'code' page, where from there. There are two drop
down boxes. The top left appears only to display className.formName, the one
on the top right displays each control on the form & the default event
(usually a click event, the event which it automatically opens to when you
click it). How do I get to all the other events.

Thanks very much for your help
Ant
 
exactly what you said. Choose the object name in the first drop down box
which would be button1 for example. then choose the event u want for it in
the second drop down box which would be mousedown or doubleclick.
 
Hi Mario,
Thanks again for your response. I still can't seem to find the events. I'm
using C# if that might make any difference to VB perhaps? The top left drop
down box only offers a single choice, that of Form1. The top right box still
only offers click events for the buttons on the form. What am I missing?
Thanks for your patience
Ant
 
Hi Ant,

C# is completely different to VB.Net regarding event handling :)

In VB.Net go to code view. There should be 2 comboboxes above the code. The left one selects the object, and the right one selects the event etc.

In C# you do this in the design view. Select the object either by clicking on it in the design or selecting it from the ComboBox above the properties dialog box. Then click on the lightning icon just below this ComboBox and the properties dialog will switch to show events. DoubleClick the event to create a default name for the event, write the name of the event in the field left of the event name or select from a list of already created events with the same kind of EventHandler (handy if you have a bunch of different controls and want to have a single Click event for all of them).
 
That's great. thank you. I should have made myself more clear re C# earlier.
Thanks Mario as well

Ant
 
That's ok. Usually coding in C# is VB.Net is identical save the syntactical differences, but event handling is one of the exceptions. You are not the first one to ask about it :)
 
Morton,

Sadly enough will it be in the VB 2005 version the same as in C#.

I have nothing against C# however I find the VBNet method much easier and
quicker.

Cor
 
Back
Top