how to get index value of menuitem
-
hi all, anyone help me? i have generated menus at run time.Now i want to disply reports on each menu.But i can't get index value of menu.I have created one click event for the menu but how i can identify the index of menu which is clicked.plz help me.
poonam
-
hi all, anyone help me? i have generated menus at run time.Now i want to disply reports on each menu.But i can't get index value of menu.I have created one click event for the menu but how i can identify the index of menu which is clicked.plz help me.
poonam
I am still confused on what you are trying to accomplish. Are you wanting an index value to determine what report to print? By the way, every control has a Tag variable. You could set integer values in the tag to differentiate betten the menu items. Cheers! Richard
may your code be error free. (okay, maybe two lines.)
-
I am still confused on what you are trying to accomplish. Are you wanting an index value to determine what report to print? By the way, every control has a Tag variable. You could set integer values in the tag to differentiate betten the menu items. Cheers! Richard
may your code be error free. (okay, maybe two lines.)
Hi Richard Hw can i set tag value,Becoz my menus are generating at run time.Thats why i have created event handler.If i don't know which menu is clicked runtime then hw i can show the reports.I need a code which will store index value of a menu which is clicked. by the way thanks for reply
poonam
-
Hi Richard Hw can i set tag value,Becoz my menus are generating at run time.Thats why i have created event handler.If i don't know which menu is clicked runtime then hw i can show the reports.I need a code which will store index value of a menu which is clicked. by the way thanks for reply
poonam
Please post the code of how the menus are dynamically generated.
may your code be error free. (okay, maybe two lines.)
-
Please post the code of how the menus are dynamically generated.
may your code be error free. (okay, maybe two lines.)
[code] Dim mShowMenuItem As System.Windows.Forms.MenuItem mShowMenuItem = DirectCast(sender, System.Windows.Forms.MenuItem) mShowMenuItem.MenuItems.Clear() Dim n, i As Integer Dim a, b As String s = "Select srno from cash" com = New OleDbCommand(s, con) con.Open() dr = com.ExecuteReader While dr.Read n = dr(0) End While con.Close() For i = 1 To n s = "Select account from cash" com = New OleDbCommand(s, con) con.Open() dr = com.ExecuteReader While dr.Read() a = dr(0) Dim mSubSubMenuItem As System.Windows.Forms.MenuItem mSubSubMenuItem = New System.Windows.Forms.MenuItem mSubSubMenuItem.Index = i mSubSubMenuItem.Text = a mSubSubMenuItem.Enabled = True mSubSubMenuItem.Visible = True AddHandler mSubSubMenuItem.Click, AddressOf MenuClickHandler mShowMenuItem.MenuItems.Add(mSubSubMenuItem) i = i + 1 End While con.Close() Next this will generate menus Public Sub MenuClickHandler(ByVal Sender As Object, ByVal e As System.EventArgs) 'Don't know wt to write here End Sub
poonam