473,387 Members | 1,637 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,387 software developers and data experts.

Program hanging

Cat
Hi there

I have written a C# program which writes lots of info to a text file. When
it's doing this, however, the entire program seems to hang - if you click on
the UI all of its controls disappear and it appears as a white box. It's
still writing to the file though because after about five minutes the UI
goes back to normal and the text file is complete. I've tried popping up a
form displaying a status bar but this doesn't help at all. Basically I'd
like for the UI to stay pretty while the text file is being written,
although I don't want to allow the user to do anything while the writing is
taking place. Any ideas?

Cat
Nov 16 '05 #1
3 1592
Hi Cat,

You should do the file writing asynchronously using a separate thread for the purpose or a stream's asynchronous methods (typically named using Begin and End, as in BeginRead, BeginWrite). A separate thread would let you implement a progress bar too.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
If you're having a progress bar and updating it, do be careful. Updating
controls from other threads can get real messy if you dont do it the
right way

--
Sriram Krishnan
Microsoft Student Ambassador
Manager - Chennai .NET Student User Group (www.cnugstudent.net)
I blog at http://www.dotnetjunkies.com/weblog/sriram
Nov 16 '05 #3

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

Similar topics

8
by: briforge | last post by:
I am writing a program for the Palm OS in c++. I have already posted this to a palm development forum but I'm desperate for a fix, so I hope this cross-post isn't offensive. My program is...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
3
by: Microsoft | last post by:
Hi I have a c# program that continually runs 24/7 and performs a variety of tasks based on a timer. There is one routine that hangs every Saturday morning without fail. If I restart the...
1
by: vquanski | last post by:
How to program around ora-02068 error On DB2 side, newbie to oracle platform. . .HELP !! Oracle procedure, db link to DB2, gets 02068 rpc disconnect errors inconsistently/randomly, each require...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.