473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

understanding events

I am a intermediate VB6 programmer moving to VB.NET using the book
"Programming Microsfot Visual Basic.net" (Microsoft Press)

I have understood so far what is going on but I am haveing a bit of
dificulty with events. My problem isn't syntax or howto or any of that, my
questions are:

What is the purpose of an event?
What is the "target" of the event (ie. who does what to whom)
Is there a difference between events in a class that you made and events in
built-in classes

Any help would be appreaceated.

Thank you.
Erik of Ekedahl
Nov 21 '05 #1
4 1305
If you've been programming in VB6 you know all about events. Whenever you
do programmed something for a button click or a form load in VB6 those are
all events. In VB.NET they just let you see more of the details than in the
VB6 world.
What is the purpose of an event? To notify a listener that something has happened
What is the "target" of the event (ie. who does what to whom) You really have a producer (object that fired off the event, such as a
button) and a consumer (the object that is listening for the event, such as
a function in your personal class)
Is there a difference between events in a class that you made and events
in built-in classes Nope

Chris

"Erik Ekedahl" <ch*****@hotmial.com> wrote in message
news:o5********************@bright.net...I am a intermediate VB6 programmer moving to VB.NET using the book
"Programming Microsfot Visual Basic.net" (Microsoft Press)

I have understood so far what is going on but I am haveing a bit of
dificulty with events. My problem isn't syntax or howto or any of that, my
questions are:

What is the purpose of an event?
What is the "target" of the event (ie. who does what to whom)
Is there a difference between events in a class that you made and events
in built-in classes

Any help would be appreaceated.

Thank you.
Erik of Ekedahl

Nov 21 '05 #2
Erik,

"Erik Ekedahl" <ch*****@hotmial.com> schrieb:
I am a intermediate VB6 programmer moving to VB.NET using the book
"Programming Microsfot Visual Basic.net" (Microsoft Press)

I have understood so far what is going on but I am haveing a bit of
dificulty with events. My problem isn't syntax or howto or any of that, my
questions are:

What is the purpose of an event?
The purpose of an event is not notify event listeners. Classes, for
example, can subscribe to an event by providing an event handler and tieing
it to an object's event in order to get notified when the event is raised.
What is the "target" of the event (ie. who does what to whom)
An object raises an event if something is happening and other objects can
handle this event, which means that they can provide a method that is called
when the object's event is raised.
Is there a difference between events in a class that you made and events
in built-in classes


In general, there is no difference. There is a certain pattern that tells
how events should be implemented in reusable classes. You can find it in
the events documentation.

Events in VB.NET are very similar to those in VB6. I suggest to read the
documentation on events in Visual Basic .NET to understand the changes. If
you have any questions, feel free to ask them here.

Visual Basic Language Concepts -- Events and Delegates
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconEventsDelegatesInheritance.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Erik,

In past there where no events, everything was driven by the procedures, what
did mean that it was forever. Sent something to a screen, test if there
comes someting back.

Now a user can do everything with his mouse. So it is better to let the
program be driven by the events which are handled direct by the OS. A event
can be a mouseclick, an enter key etc.

You have to handle those events.

That is simple in VBNet.

When you have draged a button on your formlayout. Than you can click on that
and there is directly a click event as a sub created in the codepart. In
that you can set the code that you want to do because of that button click.

When you want other events you can look to the combobox in the left top of
your codepage and select that button. In the right combobox you can than
select the event, that is direct created.

There are more methods to trigger/catch an event. However I think this is
enough to start.

I hope this helps?

Cor
Nov 21 '05 #4
Thanks guys, Just needed that little bit to get me past the mental block!
Erik of Ekedahl
"Erik Ekedahl" <ch*****@hotmial.com> wrote in message
news:o5********************@bright.net...
I am a intermediate VB6 programmer moving to VB.NET using the book
"Programming Microsfot Visual Basic.net" (Microsoft Press)

I have understood so far what is going on but I am haveing a bit of
dificulty with events. My problem isn't syntax or howto or any of that, my
questions are:

What is the purpose of an event?
What is the "target" of the event (ie. who does what to whom)
Is there a difference between events in a class that you made and events
in built-in classes

Any help would be appreaceated.

Thank you.
Erik of Ekedahl

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: downwitch | last post by:
Hi all, I'm trying to get my head around custom events, and I can't. I can use custom classes and collections out the wazoo, but I just don't get what events are for, or how they work. I've...
3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
29
by: Brett | last post by:
I'd like to better understand how the following code works. I've posted questions below. namespace Something.Something1 { using System; public delegate void Test1(); public delegate void...
3
by: serge calderara | last post by:
Dear all, I am trying to understand postack event ordering. for that I have a web form with a text box, listbox and button server controls. Then I add a response.write in eaxh control event...
3
by: jm | last post by:
>From a C. Petzold book I have Programming Windows C#. It's a little old now, but anyway, it has on page 71 (shortened): form.Paint += new PaintEventHandler(MyPaintHandler); static void...
6
by: Bryan | last post by:
Lets say I have a form From1, and I add a text box to it, TextBox1, in the VS2005 form designer. I set the 'Text' property of TextBox1 to "Original" using the properties dialog box in the form...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.