| | |
Visual Basic 6.0
![]() |
•
•
Join Date: May 2008
Posts: 51
Reputation:
Solved Threads: 0
Hi,
If Not IsNull(rs!permaddr1) Then
mpaddr1 = Mid(rs!permaddr1, 1, 500)
Else
mpaddr1 = " "
where permaddr1 is a field type of varchar(1500).
Example
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)
Next
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
Chennai-1.
Chennai-1.
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...................
If Not IsNull(rs!permaddr1) Then
mpaddr1 = Mid(rs!permaddr1, 1, 500)
Else
mpaddr1 = " "
where permaddr1 is a field type of varchar(1500).
Example
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)
Next
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
Chennai-1.
Chennai-1.
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...................
Have you tried thr TRIM() Function?
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
•
•
Join Date: Sep 2006
Posts: 36
Reputation:
Solved Threads: 1
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
to say:
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
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:•
•
•
•
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Print #1, Tab(1); astrSplitItems(intX); Tab(42); astrSplitItems(intX)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Print #1, Tab(1); Trim(astrSplitItems(intX)); Tab(42); Trim(astrSplitItems(intX))
If neither of those things helps any, let us know, and we'll see what else we can come up with. Good luck!
- Sen
Last edited by sendoshin; Oct 28th, 2008 at 10:54 am. Reason: code spacing
tRY THIS
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
Regards
Shaik Akthar
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
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) Next 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
Regards
Shaik Akthar
•
•
Join Date: May 2007
Posts: 3
Reputation:
Solved Threads: 0
Follow my signature. I have explained connecting with databases in VB6 in step by step lessons
•
•
Join Date: Sep 2006
Posts: 36
Reputation:
Solved Threads: 1
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
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
![]() |
Similar Threads
- Playing .Wav/MIDI files in a Visual Basic Program (Visual Basic 4 / 5 / 6)
- Creating an OS in visual basic 6.0 (Visual Basic 4 / 5 / 6)
- The Move.....Visual Basic 6, Visual Basic .NET ? (VB.NET)
- Encrypting a Visual Basic application (Visual Basic 4 / 5 / 6)
- passing arrays in visual basic (Visual Basic 4 / 5 / 6)
- Visual Basic.net (VB.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: How to launch a Crystal 11 report from VB6
- Next Thread: Text collect from MSflexgrid to textbox
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





