473,805 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner's Question on saving arrays to a file.

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.write line(eachItem). Here is my code for saving:

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

intMaximum = lstDisplay.Item s.Count

Do Until intIndex = intMaximum

If Not MemRecords(intI ndex).strText = "" Then
datMemory.Write Line(MemRecords (intIndex).strS ubject)
datMemory.Write Line(MemRecords (intIndex).datD ate)
datMemory.Write Line(MemRecords (intIndex).strT ext)
Else
intMaximum += 1
End If
intIndex += 1
Loop

datMemory.Close ()
mblnIsDirty = False

Nov 20 '05 #1
1 1432
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
mi************@ radarwire.com

"Bill Maher" <wm****@naic.or g> wrote in message
news:03******** *************** *****@phx.gbl.. .
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.write line(eachItem). Here is my code for saving:

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

intMaximum = lstDisplay.Item s.Count

Do Until intIndex = intMaximum

If Not MemRecords(intI ndex).strText = "" Then
datMemory.Write Line(MemRecords (intIndex).strS ubject)
datMemory.Write Line(MemRecords (intIndex).datD ate)
datMemory.Write Line(MemRecords (intIndex).strT ext)
Else
intMaximum += 1
End If
intIndex += 1
Loop

datMemory.Close ()
mblnIsDirty = False
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2733
by: Duncan Smith | last post by:
I am having problems saving arrays to file. e.g. >>> t1 array() >>> t2 array() >>> t3 array() >>> t4 array(,
8
2383
by: Grrrbau | last post by:
I'm a beginner. I'm looking for a good C++ book. Someone told me about Lafore's "Object-Oriented Programming in C++". What do you think? Grrrbau
2
1637
by: Pasacco | last post by:
dear I want to ask help on this problem. Array a is partitioned into a0 and a1 in main(). Then a1 is partitioned into a2 and a3 in th_partition() function. And I think this problem is something about parameter passing. If someone give me comment, it will be thankful. thankyou very much
12
1894
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that the build fails with what the book tells me to do. Specifically, I am doing this: public authors1 GetAuthors() { authors1 authors = new Authors1();
9
2030
by: me | last post by:
Hi All, I am new to Classes and learniing the ropes with VB.NET express Here's my question - say I have a want to manage a list of books. Each book has an Author, Title and ISBN Now, I am used to using Arrays so I would normally do something like this: Set an array up during the init routine (called from form_load) say of
8
4179
by: Yu SONG | last post by:
Hi all, What would be the most efficient way to save an array of floats to a file (in text format)? At the moment, my code looks like: /* * Saving an array of floats to a file
4
1927
by: mlamb1 | last post by:
I have some code that works it seems a bit of a hack. I want to know if there is a more c++y way to do it. Here's my code:- class CMyClass{ public: void Save(CFile fOut); void Load(CFile fOut);
8
1880
by: isaac2004 | last post by:
hello, i posted with a topic like this but got no real feedback(prob cuz of lapse in my explanation) so i am trying it again. i am trying to set up a function that brings in a txt file and adds the file into a 2d array. I have this to get the file. #include <iostream> #include <string> #include <fstream> using namespace std;
3
1912
by: darren | last post by:
Hi there Im working on an assignment that has me store data in a buffer to be sent over the network. I'm ignorant about how C++ stores data in an array, and types in general. If i declare an array of chars that is say 10 bytes long: char buff; does this mean that i can safely store 80 bits of data?
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.