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?
Create a folder using input from a text box
Collapse
X
-
Originally posted by kevintI 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?Code:Private Sub Command1_Click() MkDir Text1.Text End Sub
-
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.KumarComment
-
Originally posted by Pramodraya...I need to give path also in the above syntax. can you please help in this regard.
[CODE=vb]Private Sub Command1_Click( )
MkDir "C:\Temp\" & Text1.Text
End Sub[/CODE]Comment
-
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.Comment
-
Originally posted by PramodrayaWith 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.
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.Comment
-
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,
PramodComment
-
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.Comment
-
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,
PramodComment
-
Originally posted by PramodrayaPlease 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.
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.
Originally posted by PramodrayaDoes concatenation of strings work with move command?Comment
-
Hi Killer,
In the below VB code I want to input "password" in encripted format using InputBox, please help me in this regard
[CODE=vb]Dim Pwd As String = String.Empty
Dim Obj As Object
Pwd = InputBox("Enter the password", "Security")
If Pwd = "Password" Then
Dim oSettings As New Settings
oSettings.ShowD ialog()
LoadXml()
ElseIf Pwd = "" Then
Else
MessageCall("In avalid password", MessageBoxButto ns.OK)
End If[/CODE]Comment
-
Originally posted by PramodrayaHi Killer,
In the below VB code I want to input "password" in encripted format using InputBox, please help me in this regard
Code: ( vb )
Dim Pwd As String = String.Empty
Dim Obj As Object
Pwd = InputBox("Enter the password", "Security")
If Pwd = "Password" Then
Dim oSettings As New Settings
oSettings.ShowD ialog()
LoadXml()
ElseIf Pwd = "" Then
Else
MessageCall("In avalid password", MessageBoxButto ns.OK)
End If
it will make your UI good.
Originally posted by PramodrayaWith 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.Comment
-
Originally posted by Pramodraya... In the below VB code I want to input "password" in encripted format using InputBox ...
InputBox is really just a "quick and dirty" way to grab some text. I would only recommend using it during development as a shortcut. In a finished application you should develop your own user interface. The simplest way to do so in this case would be to stick a textbox and a couple of buttons on a form, put a bit of logic in there to handle the buttons, then show that modally (in VB 2005 I think that's done by ShowDialog).
Because it's "modal", control doesn't return to the calling code until the form is hidden or unloaded. So you can call it here in place of your InputBox and still use the same logic.Comment
Comment