rmatthew Posted January 22, 2003 Posted January 22, 2003 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????? Quote
*Gurus* divil Posted January 22, 2003 *Gurus* Posted January 22, 2003 That code looks fine to me, step through it with a debugger and you may find that the WriteLine is only being called once. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Nerseus Posted January 23, 2003 *Experts* Posted January 23, 2003 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 Quote "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
*Gurus* divil Posted January 23, 2003 *Gurus* Posted January 23, 2003 Sadly VB.NET doesn't enforce parens when calling a function with no parameters. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.