How to populate a Browse file's Textbox based on file selected in other Browse txtbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prashantdixit
    New Member
    • Jun 2010
    • 36

    #1

    How to populate a Browse file's Textbox based on file selected in other Browse txtbox

    Hi,

    I have a form "FormA" which three browse button and texbox control.

    There two radio buttons at the top with option
    option1: Auto
    option2: Manual

    These option decides how to select a file through Browse dialog button

    When user select "Auto" option and out of three Browse dialog controls, two gets disabled (i.e grayed out) and only one dialog file remains active.

    User selects "browse" button against this active browse dialog control and select a particular file from a folder. Folder contains atleast three files in format as shown below:

    Sine Survey AVI-2009-Spectrum.txt
    Sine Survey AVI-2009-Controls.txt
    Sine Survey AVI-2009-Limit-Channels.txt

    When Auto option is selected, User is bound to select "Sine Survey AVI-2009-Spectrum.txt" file in the ONLY ACTIVE dialog box control from this folder.

    What i am trying to do is that if user select first file in First Browse Text box then, in other two Browse textbox control should show other two files path (and both remain grayed out).
    i.e

    Textbox2: C:\NewFolder\Si ne Survey AVI-2009-Controls.txt
    Textbox3: C:\NewFolder\Si ne Survey AVI-2009-Limit-Channels.txt

    Since there prefix are same and hence i am assuming that i need to look for the file with same prefix in same folder.

    Can some one help me on this

    Thanks
    Prashant
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    You haven't explained the intended logic behind your question Prashant. You've told us what it should do in a single instance rather than the logic of what it should do generally, and the particular instance you use gives very little clue as to what you mean.

    Comment

    • prashantdixit
      New Member
      • Jun 2010
      • 36

      #3
      The idea behind this it to make "Data Import" of some text files in a Excel sheet.

      I have a form for this "Form A" and three browse dialog button as mentioned above.
      Form A also has Import Button (I have done the import part)
      Now user select three files (these files have same prefix as i have given example in my above comment) from each Browse Dialog controls and their respective paths display in corresponding textboxes
      When user clicks on Import button, the data in three different worksheets get imported from three PATHs.

      Now as you can see, user has to choose three files through three different browse button. To make it more faster, I am using "Auto" option. So if Auto option is selected and then by just selecting "First Text file" through one of the Browse button, paths of the other two related files (with same prefix) should get Populated in other two Browse Textbox controls. This way user will have to browse and select one file instead of three that was happening earlier. And now user can Import data using Import button(Import button click event read paths from three control and then import data in excel sheet)

      Hope this helps
      Thanks
      Prashant

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Not greatly I'm afraid. Let me see if I can break this down for you :
        1. What do we know about the files?
        2. Are they all in the same folder?
        3. Do we get the folder information from the first browse control?
        4. Is the prefix for the files the same for all the files we want to import?
        5. How do we recognise what part of the name is the prefix?
        6. Are there always exactly the same number of files with set values in the name after the prefix?
          EG.
          C:\Folder\Prefi x1_RestA.Txt
          C:\Folder\Prefi x1_RestB.Txt
          C:\Folder\Prefi x1_RestC.Txt
          C:\Folder\Prefi x2_RestA.Txt
          C:\Folder\Prefi x2_RestB.Txt
          C:\Folder\Prefi x2_RestC.Txt

        Comment

        Working...