How to create a mene with the following structure in run time?
MyMenu
--mnuLevel_1[0]
-----mnuLevel_2
..
--mnuLevel_1[j]
-----mnuLevel_2
..
The first level is OK, which can be acheived by defining an array in design time. The problem is in the second level due to the name conflict.
MyMenu
--mnuLevel_1[0]
-----mnuLevel_2
..
--mnuLevel_1[j]
-----mnuLevel_2
..
The first level is OK, which can be acheived by defining an array in design time. The problem is in the second level due to the name conflict.
文章標籤
全站熱搜

第二層的 menu 設定不正確。你應該把每一層子 menu 都設為一個獨立的 control array,例如 MyMenu …mnuLevel(1) ……mnuLevel_1(1) ……mnuLevel_1(2) <略> …mnuLevel(j) ……mnuLevel_j(1) ……mnuLevel_j(2)
The problem is that, you have to assign distinct names for th second level menus, such as, mnuLevel_1 and mnuLevel_j, in design time, but that is impossible because you don't know how many are needed. VB doesn't allow to rename a menu in run time. One possible solution, but not natural, is to estimate size for the first level, i.g., 30 or big enough for the application, then assign distinct names for the second level menus. In run time, use visible/invisble to act as load/unload functionalities.
你說得沒錯。由於 VB 無法在程式執行時讓 menu 無中生有,所以只能用你說的方法了。