PC Review


Reply
Thread Tools Rate Thread

Beginner's Question on saving arrays to a file.

 
 
Bill Maher
Guest
Posts: n/a
 
      6th Oct 2003
I have an array that I use to write to the file on the C:\
drive.

I want to print the file. How can I do it.

Here is my code for the write to the file:

I'm using "writeline". To allow for possibly deleted
items, i first check for emptry strings, and then I do
datMemory.writeline(eachItem). Here is my code for saving:

Dim datMemory As New StreamWriter("MemoryHelper.txt")
Dim intIndex As Integer
Dim intMaximum As Integer

intMaximum = lstDisplay.Items.Count

Do Until intIndex = intMaximum

If Not MemRecords(intIndex).strText = "" Then
datMemory.WriteLine(MemRecords(intIndex).strSubject)
datMemory.WriteLine(MemRecords(intIndex).datDate)
datMemory.WriteLine(MemRecords(intIndex).strText)
Else
intMaximum += 1
End If
intIndex += 1
Loop

datMemory.Close()
mblnIsDirty = False

 
Reply With Quote
 
 
 
 
Mike Caputo
Guest
Posts: n/a
 
      6th Oct 2003
Well, first I'd say you should use a "For Each" loop to make your life
easier (you can do this even with arrays since they now implement the
ICollection interface).

As for printing, just use a PrintDocument object.

--


Michael Caputo
Programmer/Database Administrator
Simon Economic Systems Ltd.
847-272-7691
(E-Mail Removed)

"Bill Maher" <(E-Mail Removed)> wrote in message
news:036a01c38c26$7df044d0$(E-Mail Removed)...
I have an array that I use to write to the file on the C:\
drive.

I want to print the file. How can I do it.

Here is my code for the write to the file:

I'm using "writeline". To allow for possibly deleted
items, i first check for emptry strings, and then I do
datMemory.writeline(eachItem). Here is my code for saving:

Dim datMemory As New StreamWriter("MemoryHelper.txt")
Dim intIndex As Integer
Dim intMaximum As Integer

intMaximum = lstDisplay.Items.Count

Do Until intIndex = intMaximum

If Not MemRecords(intIndex).strText = "" Then
datMemory.WriteLine(MemRecords(intIndex).strSubject)
datMemory.WriteLine(MemRecords(intIndex).datDate)
datMemory.WriteLine(MemRecords(intIndex).strText)
Else
intMaximum += 1
End If
intIndex += 1
Loop

datMemory.Close()
mblnIsDirty = False


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[MSH beginner question] how to test for file existence and delete them Lloyd Dupont Microsoft Dot NET Framework 0 10th Apr 2006 06:21 AM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= Microsoft ASP .NET 7 3rd Feb 2005 02:47 PM
C# and EXCEL question saving a file saving the the first column as read only mathieu cupryk Microsoft C# .NET 0 6th Jan 2005 10:19 PM
EXCEL question saving a file saving the the first column as read only Luis Esteban Valencia Microsoft ASP .NET 0 6th Jan 2005 07:02 PM
[Beginner] Arrays of variable length in c# Flix Microsoft C# .NET 4 22nd Jul 2004 12:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.