Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 30th, 2007, 10:28 AM
Registered User
Join Date: Jun 2007
Location: , , .
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)

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 :-


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) & ",")
End Sub

I get :-




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

  #2 (permalink)  
Old July 1st, 2007, 08:02 AM
Registered User
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

This has been resolved.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 03:22 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.