In my personal experience, and based only on my personal experience, textboxes - and by associations - comboboxes - used in a menu need careful consideration. Most of the time I have found I can avoid them in various other ways. I have found them to be difficult to work with and also not the most intuitive control feature. How will the user "select" the windows path?? I know I would not want to type: "C:\Documents and Settings\rjohnson9\My Documents\OneNote Notebooks\Personal Notebook" every time and ensure I got it right. You will need to ensure you have some good error handling and the like if that is the case.
As a reference/example, open any number of programs that are available today...Windows Explorer, Microsoft Outlook, Word, Excel, Firefox, Opera, Internet Explorer, even Visual Studio... You will find that textboxes and comboboxes have VERY SPECIFIC usages in any of these applications menus. They are selections for other buttons and controls...not truly controls in the traditional sense in and of themselves.
The proper way to do what you are trying to do will involve a lot of coding and thought...You will most likely need to leverage one of the Draw or Paint events and control the creation of the textbox and the menuitem container for that textbox yourself. You will then need to add it to the menu during runtime and assign some EventHandling to it to make it do what you want.
Instead, I challenge you to look for an alternate solution...perhaps a small modal form that you pop up when a button or menuitem is pressed that houses the textbox you want. Here the user can enter the info. You them have control over the textbox at design time and can control the events as necessary.
I would also like to recommend the use of the FolderBrowserDialog control available in Visual Studio. This control allows a user to pick a folder, just like Windows Explorer, and then you can open that folder in Widows Explorer if that is your wish. Also, I recommend you look to AppConfig or the Settings for the project to record the selection by the user and return to that selection the next time they execute this task. This method is very simple, as the FolderBrowserControl is built into the Visual Studio suite and is designed for just this purpose. And your code would look something like:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If FolderBrowserDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then
Process.Start("explorer.exe", FolderBrowserDialog1.SelectedPath)
End If
End Sub
In short, what you originally requested is doable, but will require a bit of work (OwnerDraw controls and AddHandler for events), but you may be able to accomplish this task in a more effective and intuitive manner.
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer