Visual Basic 6.0

Reply

Join Date: May 2008
Posts: 51
Reputation: santhanalakshmi is an unknown quantity at this point 
Solved Threads: 0
santhanalakshmi santhanalakshmi is offline Offline
Junior Poster in Training

Visual Basic 6.0

 
0
  #1
Oct 28th, 2008
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...................
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 42
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: Visual Basic 6.0

 
0
  #2
Oct 28th, 2008
Have you tried thr TRIM() Function?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 36
Reputation: sendoshin is an unknown quantity at this point 
Solved Threads: 1
sendoshin sendoshin is offline Offline
Light Poster

Re: Visual Basic 6.0

 
0
  #3
Oct 28th, 2008
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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Print #1Tab(1); astrSplitItems(intX)Tab(42); astrSplitItems(intX)
to say:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Print #1Tab(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
Last edited by sendoshin; Oct 28th, 2008 at 10:54 am. Reason: code spacing
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 304
Reputation: aktharshaik is an unknown quantity at this point 
Solved Threads: 37
aktharshaik's Avatar
aktharshaik aktharshaik is offline Offline
Posting Whiz

Re: Visual Basic 6.0

 
0
  #4
Oct 29th, 2008
tRY THIS


Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim mpaddr1 As String
  2. Dim intX As Integer
  3. Dim f As Integer
  4.  
  5. f = FreeFile
  6. mpaddr1 = "No:11/19 , Anna Salai , Chennai-1"
  7.  
  8. Open "C:\ADD.TXT" For Append As #f
  9.  
  10. For intX = 0 To UBound(Split(mpaddr1, ","))
  11. Print #f, Tab(1); Split(mpaddr1, ",")(intX); Tab(42); Split(mpaddr1, ",")(intX)
  12. Next
  13.  
  14. 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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: ilasabba is an unknown quantity at this point 
Solved Threads: 0
ilasabba ilasabba is offline Offline
Newbie Poster

Re: Visual Basic 6.0

 
0
  #5
Nov 1st, 2008
Follow my signature. I have explained connecting with databases in VB6 in step by step lessons
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 36
Reputation: sendoshin is an unknown quantity at this point 
Solved Threads: 1
sendoshin sendoshin is offline Offline
Light Poster

Re: Visual Basic 6.0

 
0
  #6
Nov 1st, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC