473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Viewing TXT file while app is in runtime.

Hi,

When writing to a text file from my application using this object:

Dim FileStream As New FileStream(strFileName, FileMode.Append,
FileAccess.Write, FileShare.ReadWrite)

ioFileOUT = New StreamWriter(FileStream)
ioFileOUT.WriteLine(strLine)

If I try to view the txt file (witn notepad) while the program it is
still running, it seem that I see only the file partially.

But when my app is terminated and the ioFileOUT.Close() is called, then
if I open the txt file, I see the whole content.

How can I make it to be able to see the whole content during the runtime?

I don't want to open/close the txt file each time the ioFileOut object
call it, because it is heavy time/CPU consuming for my needs.

Thanks very much.

Marty
Nov 21 '05 #1
3 833
Marty,
You need to call the "Flush" method of the StreamWriter in order to
flush the data that is in memory to the file.

Example:
ioFileOUT.WriteLine(strLine)
ioFileOUT.Flush()

I wouldn't recommend using the Flush() method after every line of code
you write because you will take a major performance hit if you are
writing large amounts of data to the file.

Regards,
David R. Jenkins

Nov 21 '05 #2
Marty,
You need to call the "Flush()" method of the StreamWriter:

ioFileOUT.Flush()

It is not a good idea to always call the Flush() method after each line
of data you write. You will take a major performance hit on your
program if you are writing large amounts of data.
Regards,
David R. Jenkins

Nov 21 '05 #3
Thanks you David,

Have a nice day!

Marty

je******@dont-spam-on-me.com wrote:
Marty,
You need to call the "Flush" method of the StreamWriter in order to
flush the data that is in memory to the file.

Example:
ioFileOUT.WriteLine(strLine)
ioFileOUT.Flush()

I wouldn't recommend using the Flush() method after every line of code
you write because you will take a major performance hit if you are
writing large amounts of data to the file.

Regards,
David R. Jenkins

Nov 21 '05 #4

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

Similar topics

3
by: yogesh | last post by:
How to store the java applet emebedded in a web page for offline viewing? I saved the web page but it got saved without the applet.and also I searched for the corressponding .class file for the...
7
by: B Maxey | last post by:
I have been working with encryption. And it seems to me that the IV and Key are the only things you need to decrypt my data. I can obfuscate, but my program still needs to 'call' the framework...
8
by: Subra Mallampalli | last post by:
Hi, I am trying to use <runtime> section within the web.config file. However, the contents of the <runtime> section seem to be ignored. What am i missing here? Is <runtime> section not used by...
2
by: Matthias H. | last post by:
Hi guys, Our team has a very strange problem. I hope anybody can help. We have a class called webpage and all our aspx-pages bases on it. Then we have a SYS.IO.File Class which have a...
0
by: Michelle | last post by:
Howdy! I have a windows app where you can add attachments to memos. These attachments can be anything (word, excel, pdf, etc). One form in my app lists the names of the attachments in a List...
10
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
0
by: David P. Donahue | last post by:
This is the first time I've had any problems viewing a report in any of my applications, so I'm not sure where to begin. But when I try to render my report in a report viewer, the application...
13
by: Toby Newman | last post by:
I started learning XML on Monday. I have an XML file and have written an XSL file to render it to HTML for formatted viewing in a browser. I'd like to create a second alternative view of the...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.