Click here to Skip to main content
15,910,872 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to pass command line parameters AND tab menu buttons click event into application?

My code is:
VB
Private Sub tbMenu_ButtonClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles _tbMenu_Button1.Click, _tbMenu_Button2.Click, _tbMenu_Button3.Click, _tbMenu_Button4.Click, _tbMenu_Button5.Click, _tbMenu_Button6.Click, _tbMenu_Button7.Click, _tbMenu_Button8.Click
		Dim Button As System.Windows.Forms.ToolStripItem = CType(eventSender, System.Windows.Forms.ToolStripItem)

        ActiveMdiChild.CommandPass(Button.Name) '**** Here I want to try pass my
                                                '     command but i am unable to do.

End Sub
Posted
Updated 15-Nov-11 9:04am
v3
Comments
sammsul 19-Nov-11 8:50am    
Thanks

What you SHOULD do is create a custom event and EventArgs objects, and have the MDI children subscribe to them. That way, when they handle the events, the parameters are contained within the EventArgs object and they can do whatever voodoo it is that you want to do.
 
Share this answer
 
Comments
Maciej Los 15-Nov-11 15:30pm    
...and the solutioin is...
You can get the command line with GetCommandLine() See:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683156(v=vs.85).aspx[^]

Here's an example of how to call it from managed code:

http://msdn.microsoft.com/en-us/library/x3txb6xc(v=vs.71).aspx[^]
 
Share this answer
 
Comments
sammsul 19-Nov-11 8:49am    
Thanks...
I have one of the comprehensive solutions, please see my article Enumeration-based Command Line Utility[^].

(Written in C#, but of course you can use it in your VB.NET projects.)

There are many other libraries for this purpose, but not many of them are robust enough and easy to use. I like just one other, also referenced in my work: Powerful and simple command line parsing in C#[^].

Enjoy,
—SA
 
Share this answer
 
Comments
sammsul 19-Nov-11 8:50am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900