C# forms - this.dispose? want to close automatically when done.

  • Thread starter Thread starter Ravichandran Mahalingam
  • Start date Start date
R

Ravichandran Mahalingam

Dear Readers,

I have successfully created a C# program that will load records from a
view, do some processing, write them back. I want to do this in an
unattended mode.

I want to close the program once the processing of the 500-odd records
are done.

private void frmGeoCode_Load(object sender, System.EventArgs e)
{
LoadRecords();
sendXMLToSERVER();
this.Dispose();
}

when I put a break point on this.Dispose and step through it, the
application stops.

right now, it is on my workstation - can I work on other things when
this is processing in the Visual Studio.NET IDE.

any ideas will be greatly helpful.

Objective:
1. want to run this program every 3 hours on the server; want to grab
the records from a view and process them till they are done.

thanks and regards
Ravi.
 
In general there's no reason to call Dispose on your Form object. Have you
tried this.Close when you want the form to close?

Does this app need a UI anyway? Why not just a command line app with a
simple Main method? Really it sounds like a candidate to be a Windows
Service that runs forever and sleeps for 3 hours between batches.

Brad Williams
 
Thanks Mr. Brad,

i will use that additional line mentioned in your statement.

I could have chosen 'A Console Application' and things would have easier
with that.

thanks and regards
Ravi.
 
Back
Top