Results 1 to 9 of 9

Thread: JMik u there? Anyone, please help if u can.

  1. #1
    Guest

    Exclamation

    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]

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217

    Question

    ¿¿¿¿¿¿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.

  3. #3
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    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

  4. #4
    Junior Member
    Join Date
    Mar 2000
    Location
    Montreal, QC
    Posts
    24

    Question

    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

  5. #5
    Guest
    thanks JMik and SonGouki for your replies...
    yeah, that CommonDialogue really helped a lot.
    thanks again

  6. #6
    Guest
    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?

  7. #7
    Junior Member
    Join Date
    Mar 2000
    Location
    Montreal, QC
    Posts
    24

    Thumbs up

    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

  8. #8
    Guest
    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.

  9. #9
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    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
  •  



Click Here to Expand Forum to Full Width