submenuitems not opening

  • Thread starter Thread starter JR
  • Start date Start date
J

JR

Hi,

I make some menuitems at runtime.
When the user changes somethings it will be necesairely to change that menu.
so i use clear to empty the menu and add them all again with the new ones.

the first the the menu is fine but after deleting and adding the little
arrow is in the menu but its not showing the subitems

any idees?

Jan
 
Sub sMakeLangMenu()

Dim M As MenuItem

Dim stext As String

mnuLanguages.MenuItems.Clear()

Dim di As New System.IO.DirectoryInfo(Application.StartupPath)

Me.mnuLanguages.MenuItems.Clear()

For Each F As System.IO.FileInfo In di.GetFiles("Lang_??.xml")

If F.Name.Length = 11 Then

Dim L As New clsLanguage

Dim sr As New System.IO.StreamReader(F.FullName)

Try

Dim xml As New System.Xml.Serialization.XmlSerializer(L.GetType)

L = xml.Deserialize(sr)

sText = "(" & F.Name.Substring(5, 2) & ") " & L.Language

M = Me.mnuLanguages.MenuItems.Add(stext, New EventHandler(AddressOf
mnuLanguages_Click))

If F.Name.Substring(5, 2) = Me.Tag Then M.Checked = True

M.Visible = True

Catch ex As Exception

End Try

sr.Close()

End If

Next

End Sub
 
I did some testing.

with a main menu it works file but a need to do this with a contectmenu and
in that case it wont work

Jan
 
Back
Top