Monday, August 2, 2010

How To Create Custom Event, Fields, Class In Visual Basic.Net

How To Create Custom Event, Fields, Class In Visual Basic.Net
What is event?
All the world is event driven mean that nothing happen when nothing is occur or just newton’s low of action and reaction. The same concept is applied to event that nothing executes when user does not click nothing in operating system or click a button. It simply a force and in the action operation system perform some task like lunch a program in windows environment or control the execution flow in application in yes or no operations. 
An event is a signal that informs an application that something important has happened and supports that accuracy. For example, when a user clicks a control on a form, the form can raise a Click event and call a procedure in class or .dll file that handles the event.
Name your "Windows Application" Project.
Inside the "Solution Explorer" right click on the project name a pop-up menu is open to go add  and a sub menu is open then select "Class" to add it on to your project.
Enter the class name like "CustomeEvent.vb" or whatever you like.
Open the class or object in "View Code" mode and now the real thing is start here.
In the button click event write these code.
Right click on from and select "View Code

and write the following code.

From the object list box select the "_ChangedName" Object.

From left side event list select "NameChanged" event.

And visual basic create that stub for you.
Right the code as show in figure and its time to test your costume event.
Press F5 and see the following movie for debugging.



Please comments to improve it.

No comments:

Post a Comment