|
-
Apr 20th, 2000, 06:27 PM
#1
hello there,
This is KenCJ here.. Thanks JMik for the tip on the "Common Dialogue" thing. But, there's one problem.. can I show out the file I selected into a "textbar" ?? I can't seemed to find a way to do it
What I mean here is that.. after I've selected a file, I wanted to display it in text format, showing the path of the file which i have selected. It doesn't matter whether if it's in a caption or not, just as long as I can get the path written out somewhere.
[Edited by KenC.J on 04-21-2000 at 01:48 PM]
-
Apr 20th, 2000, 11:09 PM
#2
Addicted Member
¿¿¿¿¿¿In the TextBar??????
Do mean in the caption of the form?
If that's what you mean then just set it to the filename:
Code:
Form1.Caption = strFileName 'Where strFileName is the name of the file that you selected.
Or if you want to keep the current caption and the put the filename in there as well:
Code:
Form1.Caption = Form1.Caption & " [" & strFileName & "]"
If this is not what you were talking about then please eleborate on your problem.
-
Apr 21st, 2000, 09:20 AM
#3
Addicted Member
Um, I'm not going to go back and look at your previous post *sorry*, but I'll assume you're using a CommonDialog control, correct? If that is the case then the selected file's path is returned in the FileName property. As soon as you call any of the Show methods of the dialog it is shown modally, meaning that the code in the calling procedure will 'wait' until the user has finished interacting with the dialog. When the dialog is closed (for whatever reason) the code in your procedure will begin being processed again from the point immediately after the Show method. At this point you can access the FileName property to determine what file the user selected. The FileName property will return the full path to the file and the FileTitle property will return only the name of the file.
For example:
Code:
Private Sub cmdOpenFile_Click()
Dim strFilePath As String
Dim strFile As String
CommonDialog1.ShowOpen 'Calls the dialog's Open method.
strFilePath = CommonDialog1.FileName 'Returns the full path of the selected file.
strFile = CommonDialog1.FileTitle 'Returns the name of the selected file.
End Sub
Keep in mind that this is an over-simplified example. After the Show method there is alot of errors that should test for, especially if you set CancelError to true (recommended).
Again, if this is not what you were talking about then please post again with more details. As a side note, when you elaborate on a post don't do it in the original post, just add a new post to the thread. You're lucky that I noticed the change you made to the original post, I usually don't go back and re-read the original question on a previously answered thread
-
Apr 23rd, 2000, 10:36 AM
#4
Junior Member
Hello KenC.J,
Sorry I took so long... The code I gave you last time should return a full path and filename (Like "C:\Program Files\Bleh.txt" for example). From there, you can do whatever you'd like with it, including opening it or just displaying the path in a textbox...
Hope that helps? If there's anything else, just reply.
JMik
-
Apr 23rd, 2000, 04:15 PM
#5
thanks JMik and SonGouki for your replies...
yeah, that CommonDialogue really helped a lot.
thanks again
-
Apr 27th, 2000, 04:43 PM
#6
hey, guys.. it's me again...
ok.. selecting the file, showing it out.. No problemo. But, comes another problem.. how do I send it out?
I've tried several methods, but, things doesn't work.
First of all, I don't know how to send it out as a 'file', as in, sending the file, to another user.
can u guys help me out?
-
Apr 27th, 2000, 09:23 PM
#7
Junior Member
Hey KenC.J,
Well, assuming that you're attempting to build some kind of file transfer program, you'll then have to properly set up a connection between the two computers using the Winsock control, open the file and then send it.
There's a guide on VB-World to do just that. Check it out: http://www.vb-world.net/internet/winsock/
Good Luck!
JMik
-
Apr 28th, 2000, 08:35 PM
#8
yeah.. I've got that little thingy. But, just to do some sharing with anyone who reads this.
I'm trying to develop a program that actually works like ICQ. you, know ... like.. what my main task here is to send files and messages to a specific users that are connected to a server. basically, now I've got the messages working.. but, having a major problem working with files. don't really found out my main problem yet though.
well, if any of you guys got some bright ideas on creating such a program, please share it with me. thanks.
-
Apr 28th, 2000, 11:42 PM
#9
Addicted Member
Have you tried using FTP? The Microsoft Internet Transfer Control is an easy to use control for FTP.
Just a thought.
Dan PM
Analyst Programmer
VB6 SP3 (also VB4 16-bit sometimes  )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|