Jump to content
Xtreme .Net Talk

New User question regarding use of string variable value as a new menuitem name


Recommended Posts

Posted

I would like to accomplish the following task:

1. Read the names of all folders in c:/temp

2. create a menu item for each folder that is found under c:/temp and name the menu item with the concatanation of "mnu" and "folder name"

 

I can read the names of folders under c:/temp as follows:

Dim mystring As String()

mystring = System.IO.Directory.GetFileSystemEntries("c:\temp")

 

Now I want to use the following for loop:

Dim str As String

For Each str In mystring

'...question is what do I need to do here -- the following does not work

Dim newstring As string

newstring = "mnu" & str

'...now I have the correct string in newstring which I would like to use as a name for a menu item like so:

Dim newstring As New MenuItem()

'...the issue is that newstring is already defined as a string and now I am trying to define it as a menu item.

'...How do get a menuItem whose name is equal to the value of newstring????

Next str

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...