Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's wrong with my class
Message
De
03/09/2005 05:57:06
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/09/2005 23:14:36
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01046121
Message ID:
01046525
Vues:
17
>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,
Check my other message. Changing handler from 'Click' to 'Select' works.
          AddHandler mnuItem.Select, AddressOf cmEventhandler
PS:with a command button this looks like a combo. You might instead set generated contextmenu as textBox's context menu.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform