Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    ListBox to File Help needed.

    Can anyone help with getting a list box to a file.

    I am having problems getting a list box to a file BY PROMPTING the user for a location and file name to save it by.

    I am trying to get a listbox to a file but I need to prompt the user for a path and file name to save the listbox to.

    Can someone please help ?

    Thanks.

    Jerry...

  2. #2
    Join Date
    Oct 2005
    Location
    MI
    Posts
    524
    Hi Jerry,

    Hope this helps...

    Code:
    str_YourLB = "yourListBoxName";
    str_YourTextFile = "\\AutoPlay\\Docs\\yourFile.txt"
    
    -- Count the number of entries in the listbox
    num_LBCount = ListBox.GetCount(str_YourLB);
    
    -- Make sure that the listbox had something in it
    if num_LBCount ~= -1 then
    -- Create a table of all of the listbox items by steping through the listbox -- and adding the items to a new table tbl_LBItems = {}; for num_Counter = 1, num_LBCount, 1 do
    tbl_LBItems[num_Counter] = ListBox.GetItemText(str_YourLB, num_Counter);
    end -- Write the contents of the table to a textfile overwriting any previous text TextFile.WriteFromTable(str_YourTextFile, tbl_LBItems, false);
    end
    Yeah right. Who's the only one here who knows the illegal ninja moves from the government?

    ()))))))))o)))))))==============================================

  3. #3
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    I have that part TJS

    I know how to get the listbox to a file what I an having a problem with is:

    I have to prompt the user for a path and file name to save the listbox to.

    I can't have it go where I want it to go, it has to be chosen by the user.

    For some reason I can't get the list box to a chosen path and file name. I tried this line of code but not having much luck with it.

    Code:
    PathFile = Dialog.FileBrowse(false, "Save As", "C:\\", "All Files (*.*)|*.*|", "", "txt", false, false);
    I tried this to get the path and file name from the user and have it used with a routine like you posted but it does not work. The routine I use does work if the path and file name is inbeded so I know that part worked.

    Any suggestions ?

    Jerry

  4. #4
    Join Date
    Jun 2002
    Location
    Israel
    Posts
    1,843
    your PathFile is a table, so you have to use it accordingly:

    PathFile = Dialog.FileBrowse(false, "Save As", "C:\\", "All Files (*.*)|*.*|", "", "txt", false, false);

    str_YourTextFile = PathFile[1];

    The rest is as TJS posted.

    Good luck

    Yossi

Similar Threads

  1. ListBox from Text File Help Needed BAD
    By Jerryab in forum AutoPlay Media Studio 6.0
    Replies: 21
    Last Post: 07-22-2008, 07:35 AM
  2. Error 3038: Could not seek in compressed file
    By Rikard in forum Setup Factory 7.0
    Replies: 2
    Last Post: 05-25-2006, 11:55 AM
  3. Can search allow manual browse even if file is found?
    By RichardShaw in forum Setup Factory 5.0
    Replies: 2
    Last Post: 08-28-2000, 06:08 PM
  4. Replies: 0
    Last Post: 08-17-2000, 02:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts