How to use eventSender, eventargs?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Garouda
    New Member
    • Oct 2011
    • 2

    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.
  • Garouda
    New Member
    • Oct 2011
    • 2

    #2
    Well, in the meantime, I think I have the answer to my problem...
    in my main form I wrote this code:
    Code:
    Private Sub AddingStudentRecordToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddingStudentRecordToolStripMenuItem.Click
    '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)
            WriteToLogFile("menuAddStudent_Click")
    'Create an instance of my form
            Dim MyForm As frmAdmission
    'Pass an argument
            MyForm = New frmAdmission("Add")
    'Show as ususal...
            MyForm.ShowDialog() '1 = modal
    'Release memory (I don't know whether I am using the right way...?)
            MyForm.Dispose()
        End Sub
    and in my form frmAdmission I wrote this:
    Code:
    Public Sub New(ByVal strToDo As String)
            'Call to MyBase
            MyBase.New()
            ' Windows Form Designer.
            InitializeComponent()
            ' My initialization 
            CoreFrmAdmission(strToDo)
        End Sub
    If there is something that needs to be changed, thanks for letting me know it.

    Comment

    Working...