Christian B
Member
- Joined
- Aug 5, 2005
- Messages
- 9
- Programming Experience
- 3-5
Hi,
I have a problem Programming adding different menuitems to my mainForm.MainMenu!
For Example lets see a part of the UpdateMenu function in the MainForm Class
This is called for example by onUpdateButton_clicked.
Next there is a sub wich sets the Correct menu
Now first the working call of setMenu (The test call)
But normally set Menu is called by a thread not located in the same Class
for example
An "ArgumentException" is thrown when i call "UpdateMenu" when the Thread Version runs before.
I Have no Idea why this exception is thrown.
Can anyone help me?
Christian
I have a problem Programming adding different menuitems to my mainForm.MainMenu!
For Example lets see a part of the UpdateMenu function in the MainForm Class
VB.NET:
sub UpdateMenu()
if Global.Parameters.MenuIsLoaded then
MainMenu.menuItems.add(Global.Parameters.DynamicMenu)
endif
end sub
Next there is a sub wich sets the Correct menu
VB.NET:
sub setMenu(wichmenu as byte)
Global.Parameters.DynamicMenu = special.getMenu(wichmenu)
Global.Parameters.MenuIsLoaded = TRUE
end sub
VB.NET:
sub cmdLoadMenu_clicked
setMenu(2)
end sub
for example
VB.NET:
sub cmdLoadMenuWithThread_clicked()
dim t as thread = new thread(Address of loader)
t.start()
end sub
sub loader()
setMenu(2)
end sub
I Have no Idea why this exception is thrown.
Can anyone help me?
Christian