Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I need to dump a Queue to a textfile with one item on each line. I am using the following code:

 

Dim objStreamWriter As System.IO.StreamWriter

readthread.Abort()

objStreamWriter = New System.IO.StreamWriter("c:\testtext.txt")

Do While MessageQue.Count > 0

objStreamWriter.WriteLine(MessageQue.Dequeue)

Loop

objStreamWriter.Close()

 

however; seems it just writes one line to the file (and I know I have more than that in the Queue?????

  • *Experts*
Posted

Seems like it should work assuming MessageQue is a Queue object. Did you type your sample by hand, as I think Dequeue needs parens since it's a method not a property... but try as divil said, walk through code - or write out the Count before you get in the loop to see if it's > 1.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...