VB help - mapping drive using variable
I've made a small window in visual basic 2010 with just a textbox and a submit button
What i want to happen is: Kids enter their username in to the textbox, then click submit and it maps a drive to \\server\share\"username they entered in to text box"
I also want it to create the folder if one doesn't already exist.
At the moment i have a batch file doing this:
IF EXIST Z:\*.* net use H: /Delete /y
IF NOT EXIST \\server\share\%USERNAME% MKDIR \\server\share\%USERNAME%
NET USE Z: \\server\share\%USERNAME%
The reason i can't carry on using that is because im having all kinds of issues with adobe premiere elements 9 in our media room (only 10 PCs) and so im setting up a temporary fix of a local account on the machines and each kid connecting their media storage (which is different to their home folders) via this little vb program.
At the moment i've got as far as:
System.Diagnostics.Process.Start("Net", "Use Z: \\server\share")
That maps Z: to the root of the share, now i just need to be able to create and map to a specific folder specified by the test box.
At the moment the textbox is set to max characters: 9, which is the length of our usernames. How can i make it so that it has to be a minimum and maximum of 9 (or rather: fixed at 9 characters and have the submit button locked until 9 characters are entered?
I know i can do button.enabled = false and if textbox.textlength > 8 then button.enabled = true but for some reason when i do that the submit button is enabled when i start the program, its then disabled after i have clicked it and becomes re-enabled once more than 8 characters have been entered o_O