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

You are currently viewing the Pro VB.NET 2002/2003 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 April 30th, 2006, 08:41 AM
Registered User
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Write Tab-delimited text file

I want to write a Tab-delimited text file . I will get input from dataset , which will have five columns .How to add tabs space between the columns .
If my field length is varying I don't know there length
then how to give proper structure to the file .


Old May 5th, 2006, 11:18 AM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

This would be done through iteration—nested iteration.
Pseudo-code follows:
    Open a file to receive the output.
    Set an int to columns.count, say "iCols"
    For each row of the data
        iCol = 0
        for each column

            ' I am differentiating here between WriteLine, and Write.
            ' WriteLine writes the argument, then a "new line" set of char.s.

            iCol += 1

            If iCol = iCols then
                WriteLine CurColumn's_data
                ' For text data you might want to
              ' WriteLine """" & CurColumn's_data & """"
                ' in both parts of the If.
                Write CurColumn's_data & vbTab
            End If

        Next Column

    Next Row
    Essentiall, you just "roll your own."

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to split a long string with tab delimited Andraw SQL Server 2005 27 July 17th, 2008 05:38 PM
Tab delimited Split ajindal General .NET 1 April 25th, 2006 08:20 AM
How to write to text file ? method Beginning VB 6 1 April 13th, 2006 01:54 AM
Foxpro: dbf to pipe delimited text file problem freddellosa Other Programming Languages 0 December 7th, 2005 08:55 PM
Upload tab delimited into Access? mariakovacs Classic ASP Databases 0 October 10th, 2003 10:54 AM

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