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

Form Reference

Hi I have a Form with textbox controls on it
and a run button
The Run button Starts a Class that does some
work against our Sql Database In a Loop
During this time i want to update the windows form for current status of
this Object running

Iam havein problems referencing back to the form
if i try to add refference i get a circular problem

i can call a method of the form but i can't gets it type at compile time..

any examples will help thanks

example from button click
private void btnRun_Click(object sender, EventArgs e)

{

this.btnRun.Enabled=false;

//parameters app logging class, db, txtfile or eventlog, thread id,
application xml configuration

PreProcessing.RunPreProcess oPreProc = new
PreProcessing.RunPreProcess(this.oLog, 1, this.AppInfo);

oPreProc.RunningAsService = false; // also runs as a windows service
oPreProc.Run();

oPreProc.Close(); // clean up

this.btnRun.Enabled = true;

}

i want to update the windows form and can not reference it...early binding

MJ

Apr 26 '07 #1
2 1659
>Iam havein problems referencing back to the form
if i try to add refference i get a circular problem
What problem exactly?

Instead of directly referencing the form, have you considered adding
an event that the form can handle? If the task is time consuming you
may want to run it on a background thread. If you use the
BackgroundWorker component it will handle much of the work for you.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 26 '07 #2
The Class Running is not time consumming....for the job its doing ..just
processing records via 10 or so stored procs in succession of 1st to last
and finished....
repeats while work is to be done
after each set of calls (stored procs) i want to update
my form and im having problems with events....
looking for some examples.....
TIA
MJ
example this is run() method called from form buttonclick
below is just a example ....
public int run()
{
while (this.Getcount())>0
{
if ! ( this.isService)
{
//send a event to the form need help here
}
if (this.Callproc1()<0)
{
//somthig happend
}
//do the rest of the stored procs
}

}
}
hope this helps abit
MJ

"Mattias Sjögren" <ma********************@mvps.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
>>Iam havein problems referencing back to the form
if i try to add refference i get a circular problem

What problem exactly?

Instead of directly referencing the form, have you considered adding
an event that the form can handle? If the task is time consuming you
may want to run it on a background thread. If you use the
BackgroundWorker component it will handle much of the work for you.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Apr 26 '07 #3

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

Similar topics

12
by: CJ | last post by:
Why won't this work? I am passing the name of the form (I have two that use this validation script) but I keep getting an error. Error reads: "document.which_form.name is null or not an object" ...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
12
by: Bill Todd | last post by:
Form B needs to call a public method of Form A. How can form B get a reference to the instance of Form A using its name or any other method? Is there a collection of form instances that can be...
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
4
by: jedimasta | last post by:
Good evening all, I'm a relatively new to javascript, but I've been working with ColdFusion and PHP for years so I'm not necessarily ignorant, just stuck and frustrated. Using ColdFusion I'm...
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
19
by: rbrowning1958 | last post by:
Hello, I am confused by dispose etc. and hope someone can set me right. 1. The Dispose(Bool) the IDE generates for a form has nothing to do with IDisposable, right? 2. So when is this called?...
2
by: pat.saunders | last post by:
Hi, I am using Visual Studio 2005 and am using Visual C#. I notice that the program.cs creates an instance of a form and runs it. I have a PictureBox in the form and a Class File x.cs and in the...
9
by: Brad Pears | last post by:
I have the following code that references a "textbox" on a form. I want to pass the value of this textbox to a stored procedure as a parameter. This code is located on a different form obviously. I...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.