If Not IsNull(rs!permaddr1) Then
mpaddr1 = Mid(rs!permaddr1, 1, 500)
mpaddr1 = " "

where permaddr1 is a field type of varchar(1500).


permaddr1 = "No:11/19 , Anna Salai , Chennai-1"(from sql server retriving the values)

This value is now is stored in mpaddr1.

Now, My main problem is :

when i generating the output in the notepad,i want the view like this

No:11/19 No:11/19
Anna Salai Anna Salai
Chennai-1. Chennai-1.

My code look like this :

astrSplitItems = Split(mpaddr1, ",")
For intX = 0 To UBound(astrSplitItems)
Print #1, Tab(1); astrSplitItems(intX); Tab(42); astrSplitItems(intX)

but in this code , i facing a problem that when there was an empty space
only after the comma in the mpaddr1(note:not problem ,if there was an empty space before the comma) ,the output which i was expecting not proper .In notepad view will be

No:11/19 N0:11/19
Anna Salai
Anna Salai


One more thing,if there was an no empty space after the comma the output is coming correctly.But i don't want like this ,i want the output correctly if there was an empty space before and after the comma .

Please let me know.its very urgent...................

8 Years
Discussion Span
Last Post by sendoshin

Another thing you ought to look at is whether or not you have the Word Wrap feature turned on in Notepad. Sounds like you want it off.

However, using the Trim() function, as jireh suggested, would probably help, too. Trim() will remove any leading (before the text) and trailing (after the text) spaces/tabs/etc in whatever string you pass it. So Trim(" Anna Salai ") would give you Anna Salai . Simply rewrite the line which reads:

Print #1, Tab(1); astrSplitItems(intX); Tab(42); astrSplitItems(intX)

to say:

Print #1, Tab(1); Trim(astrSplitItems(intX)); Tab(42); Trim(astrSplitItems(intX))

instead, and see if that helps.

If neither of those things helps any, let us know, and we'll see what else we can come up with. Good luck!

- Sen



Dim mpaddr1  As String
    Dim intX As Integer
    Dim f As Integer

    f = FreeFile
    mpaddr1 = "No:11/19 , Anna Salai , Chennai-1"

    Open "C:\ADD.TXT" For Append As #f

    For intX = 0 To UBound(Split(mpaddr1, ","))
        Print #f, Tab(1); Split(mpaddr1, ",")(intX); Tab(42); Split(mpaddr1, ",")(intX)

    Close #f

I think that you might be viewing in the notepad with "Word Wrap" option as TRUE. where if the line is lengthier than the window margin it is automatically wrapped down to next line.

Please check that the following option in the Notepad is FALSE
Format -> Word Wrap

Hope this solves ur problem

Shaik Akthar


Follow my signature. I have explained connecting with databases in VB6 in step by step lessons


ilasabba: At first read that suggestion sounds useless since the information is already coming from a database to begin with. It's usually a good idea to explain why someone ought to do something one way or another. In this case, it would have been good to say that santhanalakshmi could be pulling the information out of the database as separate values instead of one long string which he/she has to parse manually, and that the tutorial in your signature would explain how to do that. Makes you sound more like a helpful friend and less like a harsh know-it-all - no offense intended.

And back to santhanalakshmi: ilasabba is right. Instead of parsing the return string with every parameter in it, you could easily use the built-in database access abilities of VB6. Since VB can parse the server's return string for you, storing each value in its own neat little variable (or array element, depending on how you do it), there's really very little reason to do it yourself. For more information on how to do that, see the links in ilasabba's signature.

- Sen

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.