Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with my class
Message
From
02/09/2005 23:14:36
 
 
To
02/09/2005 09:58:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01046121
Message ID:
01046498
Views:
15
I did replaced it with MessageBox.Show() but with no positive results. I traced the order of execution of events and I think this could be the culprit. I modified my methods and placed some Debug code. Here are my modifications:
    Public Function GetStudid(ByVal pTextBox As TextBox) As String
        'Shows a context menu and returns the STUDID of the selected student
        Dim cm As New ContextMenu
        Dim mnuItem As MenuItem
        For Each dr As DataRow In DS.Tables("students").Rows
            mnuItem = New MenuItem(dr.Item("studname"))
            AddHandler mnuItem.Click, AddressOf cmEventhandler
            cm.MenuItems.Add(mnuItem)
        Next
        Debug.WriteLine("BEFORE CONTEXTMENU DISPLAY")
        cm.Show(pTextBox, New Point(0, 0))
        Debug.WriteLine("AFTER CONTEXTMENU DISPLAY")
    End Function

    Private Sub cmEventhandler(ByVal sender As Object, ByVal e As EventArgs)
        Dim cm_index = CType(sender, MenuItem).Index
        studid = DS.Tables("students").Rows(cm_index).Item("studid")
        Debug.WriteLine("STUDID CHANGED")
    End Sub
DEBUG Output:
BEFORE CONTEXTMENU DISPLAY
AFTER CONTEXTMENU DISPLAY
STUDID CHANGED

What I am expecting is somthing like this:
BEFORE CONTEXTMENU DISPLAY
STUDID CHANGED
AFTER CONTEXTMENU DISPLAY

Could this problem be related to asynchronous execution?

thanks
OMAR C. IBRAHIM
----------
Programmer
STUDENT RECORDS & INFORMATION SYSTEM (SRIS)
Western Mindanao State University, Philippines
----------
Programmer
SSI Engineering & Architectural Designs and IT Center (SENARD ITC)
Zamboanga City, Philippines
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform