Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
|
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2007, 10:28 AM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formating ListBox output to input into a file

Seems simple enough, but there is a twist.........here is the scenario:-

Within the app the user is initially presented with a series of check boxes. Depending on the number of checkboxes selected the number of items in the list box varies. In the example data below two check boxes are selected hence three lines in each "block" as the two items are associated with the master hence three items in each "block". So in my list box I have the following :-

item1 'master item 1
item2 'associated item (checkbox 1)
item3 'associated item (checkbox 2)
------
item4 'master item 2
item5 'associated item (checkbox 1)
item6 'associated item (checkbox 2)
------
etc

The dotted lines are in the listbox contents as a visual device to seperate the master & subitem "blocks". My goal is to obtain the following output :-

item1,item2,item3
item4,item5,item6
etc
etc

Using variations of this code :-

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
w = New IO.StreamWriter("c:\test.txt")
For i = 0 To ListBox1.Items.Count - 1
w.Write(ListBox1.Items.Item(i) & ",")
Next
w.Close()
End Sub

I get :-

Item1,item2,item3,item4,item5,item6,

or

item1,
item2,
item3,
item4,
item5,
item6,

I can't seem to get the output format to provide what I am looking for. Any assistance would be gratefully appreciated.

 
Old July 1st, 2007, 08:02 AM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This has been resolved.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying DOCTYPE in input to the output xml mrame XSLT 3 July 31st, 2008 04:26 PM
XSLT with output very similar to input sindrit XSLT 2 July 30th, 2007 08:38 AM
jsp - input/output - html?? tra77 JSP Basics 0 April 14th, 2006 04:35 AM
input:output file ct ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2005 09:43 AM
Multiple file input single file output.... jdm_mboy Biztalk 1 July 2nd, 2003 03:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.