Results 1 to 11 of 11

Thread: Displaying the files/documents

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Angry Displaying the files/documents

    In my application, I have a form. The foem the two portioin. In left side some files names(files are located on local hard disk) are displayed. I want that when the user selects a file from these, that should open in the right portion for the form.

    I think OLE control can do this. But I want that the document should not open in the new window but on the right side of the form.
    Attached Images Attached Images  
    software engineer

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Displaying the files/documents

    Lseft side of form must be (I'm guessing here) some sort of Listbox and right side could be Richtextbox. Clicking on the listitem will load entire file into the RTB - as simple as that. Also, I assume that you already know the actual path to each file or how would load your list otherwise.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Angry Re: Displaying the files/documents

    Yes dear, you are right.But let me clear one thing..

    The right side can't be RichTextBox.
    Because on the left side, if there is the name of a word document and a picture, then when user clicks the word document then it should be displayed on the right side and if he clicks picture the that picture should be displayed on the right side.

    So right side can't be RichText Box. I guess it should be OLE control....

    Please guide..
    software engineer

  4. #4
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: Displaying the files/documents

    Quote Originally Posted by engineer
    Yes dear, you are right.But let me clear one thing..

    The right side can't be RichTextBox.
    Because on the left side, if there is the name of a word document and a picture, then when user clicks the word document then it should be displayed on the right side and if he clicks picture the that picture should be displayed on the right side.

    So right side can't be RichText Box. I guess it should be OLE control....

    Please guide..
    i have images viewing in a picturebox so depending on what you click on, you could have it load in either an rtb or picturebox and set its visible to true or false

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Displaying the files/documents

    Quote Originally Posted by BrailleSchool
    ... depending on what you click on, you could have it load in either an rtb or picturebox and set its visible to true or false
    Exactly: you'll need at least a RTB and Picturebox. If you have more file types to display you might need to use some other controls as well (perhaps grid...). But the general idea is as described by BrailleSchool: show/hide necessary control for specific type of a file.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Angry Re: Displaying the files/documents

    Seems good but:

    User can select any file (any file type extension). He may select a text document, a picture, an acrobat file e.t.c.

    So at design time I would have to place all controls on form and then show them accordingly. Or I can create them at run time depending on the type of the selected file.

    But what should I do in the case of the file for which there is no VB control: e,g. Acrobat file ?
    software engineer

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Displaying the files/documents

    ShellExecute will open any file in it's associated program. You could use some API's to locate it in the pane, but it would be a bit of work. Maybe OLE would work?

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Angry Re: Displaying the files/documents

    Great....

    The problem of opening files has been resolved by using shell...

    Thank you dear.

    Opening the file in the right Pane:

    I also tried OLE. But the problem with OLE is that if the file is long(e.g. text file), it does not show it fully. It only shows it upto its size.

    You told that I can find some API for displaying the file in the right pane, I tried but unable to find one.

    Can you help me for opening the file in the right pane?
    software engineer

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Displaying the files/documents

    OK, here is what you may consider:

    - your right pane could be a Picturebox that will act as container
    - as David suggested you may use ShellExecute to launch file with associated program
    - you would use FindWindow to actually find most recent
    - if found then use SetParent to make that app as a child of your right pane picturebox control.
    - and so on and so forth ...

    Good luck.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    237

    Thumbs up Re: Displaying the files/documents

    Thanks.
    I am gona try FindWindow and SetParent.
    software engineer

  11. #11
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Displaying the files/documents

    Quote Originally Posted by engineer
    Great....

    The problem of opening files has been resolved by using shell...
    But the file location must be known in advance, unless you use ShellExecute, which will find the correct location of any installed app that has a file association on that machine.

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