Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / December 2005



Tip: Looking for answers? Try searching our database.

Reading data with carriage returns into a variable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
IWP506@gmail.com - 20 Nov 2005 06:03 GMT
Hey all,

I'm making a program that downloads my email.  Problem is the email
contains carriage returns.

When my winsock _dataArrival event is triggered, I use winsock.getData
myBuffer.  But during run-time when I hold my cursor over the variable
and the tooltip that shows the value comes up, myBuffer ends up only
containing "+OK email reads " and then two boxes (the character that
appears when there are cr's in the string).

I put in a clipboard.settext, and when i paste in notepad, I get the
entire email - just what I want.  So mybuffer DOES contain the entire
email, but the instr() returns 0 when the email clearly contains the
text "saf".

My question is this: how can I get the whole email in a string?

Here's my code:

-----
Private Sub tcpSock_DataArrival(ByVal bytesTotal As Long)

   Dim mybuffer As String
   tcpSock.GetData mybuffer
   commandLoc = InStr(1, mybuffer, "saf")
   Clipboard.SetText (mybuffer)
-----

Result: commandLoc = 0

Thanks
IWP506
BOB - 09 Dec 2005 21:25 GMT
Try replacing the carriage return with a printable character

Dim mybuffer As String
   tcpSock.GetData mybuffer

   mybuffer = Replace(mybuffer, vbCr, "^")

   commandLoc = InStr(1, mybuffer, "saf")
   Clipboard.SetText (mybuffer)

> Hey all,
>
[quoted text clipped - 29 lines]
> Thanks
> IWP506
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.