Re: output contents of a listbox to a sequential file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Dave (drettger_at_ameritech.net)
Date: 10/25/04


Date: 25 Oct 2004 02:30:50 -0700

One other problem you might encounter... The listbox is indexed from
0 to ListBox.Count - 1. You will be missing the first item and
generating an error on the last loop through the For ... Next block.

Ken Halter <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message news:<eoxIIEgtEHA.2864@TK2MSFTNGP09.phx.gbl>...
> Cpt.Crazyhorse wrote:
> > how do you output the contents of listbox to a sequential file that looks
> > like this
> > John Kerry 1(800)555-9898
> > Bob Dilan 1(345)555-6789
> > (this is a sample of what the items look like in listbox)
> > The names and numbers are to be seperate items
> > i tried this code:
> > dlgcommon.Filter = "Phone Directory Files(.pd)|*.pd"
> > dlgcommon.ShowSave
> > Open dlgcommon.FileName For Output As #3
> > For looping = 1 To lstMain.ListCount
> > usemeagain = Left(lstMain.Text, 20)
> > useme = Right(lstMain.Text, 15)
> > Write #3, useme, addtome
> > Next looping
> > Close #3
> > can someone steer me straight here???
>
> Left should work fine but you'll never get anything using the Right
> function if those are the names you supply <g> To avoid confusion, use
> the LeftWingFreak function instead of just Left.
>
> btw... why break up the string before writing. Just store the text
> exactly as its shown in the listbox. Also not that Write surrounds the
> output in quotes. If you use Print# instead, you can open the resulting
> file in Notepad and it'll look exactly the same as the listbox.



Relevant Pages

  • Re: output contents of a listbox to a sequential file
    ... > how do you output the contents of listbox to a sequential file that looks ... > The names and numbers are to be seperate items ... the LeftWingFreak function instead of just Left. ...
    (microsoft.public.vb.syntax)
  • Re: output contents of a listbox to a sequential file
    ... > how do you output the contents of listbox to a sequential file that looks ... > John Kerry 1555-9898 ... > The names and numbers are to be seperate items ...
    (microsoft.public.vb.syntax)
  • Re: Data missing from listbox but shows in underlying query????
    ... I'd check the data types of each field used in the criteria, ... > I noticed that one of my listboxes was missing some records, ... > is that the missing records ARE present in the underlying query ... > something, but it's clear as day - when I look at the listbox, there ...
    (microsoft.public.access.formscoding)
  • Re: Single Selection ListBoxes
    ... yeah you're right my missing bit is a variable. ... Public sRange as string ... Field 1 is not needed for my autofilter. ... >> the contents of my listbox represent both the worksheet ...
    (microsoft.public.excel.programming)
  • Data missing from listbox but shows in underlying query????
    ... Very strange problem... ... I noticed that one of my listboxes was missing some records, ... is that the missing records ARE present in the underlying query ... something, but it's clear as day - when I look at the listbox, there ...
    (microsoft.public.access.formscoding)