473,406 Members | 2,710 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,406 software developers and data experts.

How to use eventSender, eventargs?

Hello,
As this is my first post on this website, hello to everybody from Thailand where I work as a school administrator.
I wrote last year my very first full application in VB6.
Why VB6? Because I have the program and because I am using VBA since Excel supports it, say around 1995. I am now in the process of upgrading to VB.Net, ADO.Net and SQL Server.
I have a form that can be called by three different menu points for three different purposes, and I need to know which menu is at the origin of the call, as the form has to behave accordingly. The solution I was using in VB6 doesn't do the job and I would be very grateful if someone could give me some hints, thanks a lot.
Oct 29 '11 #1
1 1960
Well, in the meantime, I think I have the answer to my problem...
in my main form I wrote this code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub AddingStudentRecordToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddingStudentRecordToolStripMenuItem.Click
  2. 'I have a feature to track what users do, they can be very 'creative and never do anything wrong. I live in Thailand, the 'Land of Smiles (better known as The Land of Lies)
  3.         WriteToLogFile("menuAddStudent_Click")
  4. 'Create an instance of my form
  5.         Dim MyForm As frmAdmission
  6. 'Pass an argument
  7.         MyForm = New frmAdmission("Add")
  8. 'Show as ususal...
  9.         MyForm.ShowDialog() '1 = modal
  10. 'Release memory (I don't know whether I am using the right way...?)
  11.         MyForm.Dispose()
  12.     End Sub
and in my form frmAdmission I wrote this:
Expand|Select|Wrap|Line Numbers
  1. Public Sub New(ByVal strToDo As String)
  2.         'Call to MyBase
  3.         MyBase.New()
  4.         ' Windows Form Designer.
  5.         InitializeComponent()
  6.         ' My initialization 
  7.         CoreFrmAdmission(strToDo)
  8.     End Sub
If there is something that needs to be changed, thanks for letting me know it.
Oct 29 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Steve Amey | last post by:
Hi all I am creating a basic control to perform some tasks, and I want to declare some events to be raised so they can be handled from the form that the control is on. I can create my own Event...
2
by: ZAky | last post by:
Why do I get a System.NullReferenceException for this script? I added the following script to a simple form with a button. <Script> public event EventHandler DoThis; static void Main() {...
8
by: Phill | last post by:
All the event handlers seem to pass an Object and an EventArgs object. If the event doesn't need this info why pass them anyway? It is inefficient.
1
by: Jack Addington | last post by:
I have a 3rd party object that fires an itemchanged event when someone edits some data on a form. This event has a custom eventArgs that has a field called ActionCode. In the code of the event,...
3
by: Amil | last post by:
when i double-click on a button on a form as i am designing the form, the IDE creates a method corresponding to a event assignment as follows: this eventhandler: this.exitToolStripMenuItem.Click...
3
by: Yangtsi River | last post by:
Hi, in any event procudure,there is two paras:sender As Object, e As EventArgs, i copied them-not know what they are about, and my ASPX works. I guess the sender is the control by which I...
3
by: Leslie Sanford | last post by:
I have a hierarchy of message classes. Many times when messages are created/received by a class, an event is generated to let the outside know. Also, the message is passed along when raising the...
2
by: Bob | last post by:
Hi, I'm still new to asp.net and i would like to understand this: "Source As Object, e As EventArgs" <script runat="server"> Sub button1(Source As Object, e As EventArgs) p1.InnerHtml="You...
4
by: Frankie | last post by:
The .NET Framework provides us with built-in event handlers: System.EventHandler and the generic System.EventArgs<TEventArgs> It appears that those built-in event handler delegates are just a...
3
by: Tony | last post by:
Hello! One more thing assume I create an event and an object derived from the eventArgs containing some info about the event. Then create another event also with an object derived from the...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.