Hey guys.. i need some help.. Here is what I want to do.. A textbox contains the path of a file. I want to open the path of the file in explorer using a VB command button.
eg: The path is "C:\Program Files"
I want to open this folder in explorer using a command button. HELP me..:huh:
Iceplug
10-02-2009, 06:30 PM
Maybe try calling Shell?
Shell "explorer.exe C:\Program Files"
the code works for some extend. Thank you. but i want to open different paths regarding the textbox input from the user. I couldnt program to do that.. HELP ME..
eg: The user inputs a different path every now and then, how would i use this command then?? :huh:
Iceplug
10-03-2009, 02:56 AM
extent?
You mean a file path different than what the user has input?
Please Read and I'll try to give you some understanding:
'Try using the & symbol.
'This lets you append strings together to make one:
Dim S As String
S = "explorer.exe " & "C:\Program Files\"
'Of course, you can pass strings into Shell
Shell S
'This line opens the Program Files folder in explorer
Since both "explorer.exe " and "C:\Program Files\" are strings,
you can use any string variable or member in their place, as long as the string holds the correct information.
For example:
Dim S As String
S = "C:\Program Files\"
Shell "explorer.exe " & S
'This opens Program Files folder in explorer.exe
Dim S As String
S = "C:\Windows\"
Shell "explorer.exe " & S
'This opens Windows folder in explorer.exe
The space is important to the operation of Shell
Shell receives "explorer.exe C:\Program Files" and opens Program Files folder in explorer
Shell receives "explorer.exeC:\Program Files" without the space and will not work...
therefore you need the space
Shell "explorer.exe " & S
and therefore this won't work
Shell "explorer.exe" & S
Again, since S is a string variable and a textbox contains text as a string, you can replace the S with Textbox1.Text
Shell "explorer.exe" & Textbox1.Text
The text in the textbox must be written correctly by the user when the program is run.
e.g.
Run the program and type
C:\Windows
in the textbox.
Press applicable button and you should have Shell open this new path in explorer.exe.
I hope this is what you were looking for and is helpful.
lordefix
10-21-2009, 01:43 AM
thanks man.. it works just great now.. :D
lordefix
10-21-2009, 01:51 AM
Hey,
I got some other problems now. I am making a vb project using vb6 and the database is done in .accdb format. so when i use the Ado Datacontrol i use Microsoft.ACE.OLEDB.12.0 in the data connection string to connect.
My first problem is how do i connect the database via code. In the form_load event what should i write so that i could connect to a database using the app.path syntax.
the code i am looking for
Private Sub Form_Load()
Adodc1.connectionstring=???
ADodc1.recordset=???
End Sub
lordefix
10-21-2009, 01:58 AM
My second problem is: when is use the following code to search through an autonumber field it give errors.:confused:
Adodc_mov.Recordset.Find "[movID] like '*" & txtsearch.Text & "*'", , adSearchForward
Adodc_mov is the name of the ADO datacontrol name. MOVID is the autonumber field in the database. txtsearch.text is the search textbox.
My third problem is: I have created a query in my database. in the query when we write the ID the specific record is displayed. i want to run this query in VB6 and show the results in a MSFLEXgrid or something like that. i want to know how to connect the query using ado datacontrol??
HELP me.. thanks in advance.. :)
Iceplug
10-21-2009, 03:57 AM
Perhaps you should post in the Database forums.
Also, did you just become king of something, lordefix?
lordefix
10-21-2009, 10:00 AM
please help me.. i need help urgently?king?? what do you mean by that?