473,748 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a folder using input from a text box

1 New Member
I am trying to create a folder based on inputed text from a text box. I can create the folder without a problem, it is when I add the text box in the mix I am having issues. Can someone please help?
Nov 3 '06 #1
16 9283
Killer42
8,435 Recognized Expert Expert
I am trying to create a folder based on inputed text from a text box. I can create the folder without a problem, it is when I add the text box in the mix I am having issues. Can someone please help?
I just created a new project, threw a textbox and a command button on a form, and inserted this code. It worked.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   MkDir Text1.Text
  3. End Sub
  4.  
Nov 3 '06 #2
Pramodraya
6 New Member
Private Sub Command1_Click( )
MkDir Text1.Text
End Sub

Hi,
Using the above code, I could be able to create a directory, I need to give path also in the above syntax. can you please help in this regard.

Regards,
P.P.Kumar
Jun 27 '07 #3
Killer42
8,435 Recognized Expert Expert
...I need to give path also in the above syntax. can you please help in this regard.
Just concatenate the strings together. For example, to create folders under C:\Temp, you'd do something like this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2.   MkDir "C:\Temp\" & Text1.Text
  3. End Sub
Jun 28 '07 #4
Pramodraya
6 New Member
With the above syntax, it not creating folder in the said path "c:\Temp\"
Instead, it is creating folder with name "Text1.Text " on the current drive.
Jun 28 '07 #5
Killer42
8,435 Recognized Expert Expert
With the above syntax, it not creating folder in the said path "c:\Temp\"
Instead, it is creating folder with name "Text1.Text " on the current drive.
Nonsense !

For that to happen you'd have to have quotes in the wrong place. Unless, of course, the textbox called Text1 actually has the value "Text1.Text " in it. Um... no, not even then.
Jun 28 '07 #6
Pramodraya
6 New Member
Hi,

Please chack the below syntax again. It is not working for me.

Private Sub Command1_Click( )
MkDir "C:\Temp\" & Text1.Text
End Sub

I have placed quotes in correct place, and there is no value as such "Text1.Text "
but with the above syntax it is creating folder "Text1.Text " in the current directory. Please check above syntax in your system.

Regards,
Pramod
Jun 28 '07 #7
Killer42
8,435 Recognized Expert Expert
Ok...

I created a new project, with one form. Placed a textbox (Text1) and command button (Command1) on the form. Copied/pasted in the code from your message. Ran. Entered "gkjghsklhg " in the text box, clicked the button. It created folder "C:\Temp\gkjghs klhg".

Perhaps the folder is just left over from before? Or perhaps you have some old code that you haven't removed from your program, which is doing this. But the code as shown here will not create it.
Jun 28 '07 #8
Pramodraya
6 New Member
Hi Killer42,

Please give me a solution in 'visual basic 2005' for which, I need to move 3 files "a, b, c" from different locations to a folder ‘P’. The folder ‘P’ which is to be created using input from text box. Does concatenation of strings work with move command?

Thanks & Regards,
Pramod
Jul 2 '07 #9
Killer42
8,435 Recognized Expert Expert
Please give me a solution in 'visual basic 2005' for which, I need to move 3 files "a, b, c" from different locations to a folder ‘P’. The folder ‘P’ which is to be created using input from text box.
I can't provide VB 2005 code, as I only work with Vb6. I plan to start learning the later version soon, but that's no help to you.

Hopefully someone else here can do so, but I believe you should spend some time reading the doco, as creating a folder is a pretty basic (no pun intended) operation. One thing which might be a good idea is to use the FileSystemObjec t object. This provides lots of great functionality for working with drives, folders and files. Just note that to use it, you have to add a reference to "Microsoft Scripting Runtime" to your project.

Does concatenation of strings work with move command?
That's a much easier question. It doesn't matter what command or statement you're dealing with. When you deal with a "string" in VB, generally this can be absolutely any expression which resolves to a string. It doesn't matter whether this means concatenating strings, invoking functions, or whatever. The string "ABC" is functionally no different from the string Chr(65) & Chr(Asc("B")) & "C".
Jul 2 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
17872
by: Dave | last post by:
I have an application where I am providing the user the ability to select or create a folder on a domain, using SHBrowseForFolder. When the user selects/creates a folder on a remote computer, it returns the UNC path of that folder. Using ADSI IADsFileShare, I would like to create that share, but the ..Path property seems to reject the UNC. Is there a way of converting that UNC to the logical drive path or some other way of setting the...
2
12181
by: DCount17 | last post by:
I'm new to .NET and C#. I need help in trying to do the following: I need to use a URI (or something else) that allows all users of the application to be able to access a directory and create a folder. The code that works for some users is: string DirLoc = "\\\\abc-prod01\\c$\Inetpub\\wwwroot\\Units\\" Directory.CreateDirectory(DirLoc); Users that (I assume) don't have access on this web server, get the following message: Could not find a...
1
3502
by: namanhvu | last post by:
Hi everyone, I'm trying to create a form where the radio button is automatically selected when the input text field beside it is clicked. I know I need to use "onClick" somewhere but I don't know how. With links I found it it would work like this: <SCRIPT LANGUAGE="JavaScript"> function click(which) {
3
4009
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table with a createElement function to add additional entries. The table has the first row of input text boxes already in it. You have to click a button to add another row. That seems to be working fine. How do I pull the information from the input boxes...
3
3229
by: yangtono | last post by:
Hi, I'm trying to create a function that allows me to append the character at input text and display them on the div tag below. But the screen shouldn't refresh, therefore I'm using AJAX. But I can't seem to get it done, not really familiar with AJAX. Wonder if anyone here can help me out. Below is the code: <HTML> <HEAD>
2
1310
by: msr | last post by:
Dear all Can anyone help me I've written VB program to save Pid and date into ms-access database but i need to alter my program in a way when i enter pid and date then automatically folders for pid(eg. ab123) and date(eg. 2007-07-20) has to be created on desktop Can anyone help me how can write vb program for this
2
2080
by: Jeterdawg | last post by:
Hello, extreme newbie here... I am trying to create a drop-down menu (select input type), and based on which of the options the user selects (Yes or No), an input text box appears for the user to enter their member number. Unless the user selects "Yes" from the menu, this box shouldn't appear. I have tried two options -- using javascript within my php file (onSelect) and a simple if statement (with no javascript) basically saying if...
1
3733
by: meenu_susi | last post by:
hello could u please send me the code for creating a folder in ftp server using vb script I have tried with the following code <script language="vbscript"> Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder("ftp://ftp.xx.xx..com") </script>
1
5542
by: jags | last post by:
HI All I was trying to create Document librray programatically in a Sharepoint Site and is not working for me.I was trying to implement this as an Event Handler. The aim of the code is to create a Folder with the same name as in folder which has been added.For eg if i am creating a folder titled A in a Doc library called A1 then I shud have a folder names A in a document library called as 'Request for Proposals' (this is predifened) below...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.