| | |
openin more forms C#
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
The reason I asked is every time that clicked functions called its going to add another copy of the event so you could end up with the same function called multiple times per event.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Jul 2008
Posts: 27
Reputation:
Solved Threads: 0
Well thats true so!!!!
Is this the right way to solve this problem:
form1.MyEvent -= new MyDelegate(form1.OnEvent);
should i put this after I call clicked();
Do you think that this is the problem why my program freezes when i switch forms!!!
If the function is going to be called more times that shouldn't block the code it will only slow it down!!!
Is this the right way to solve this problem:
form1.MyEvent -= new MyDelegate(form1.OnEvent);
should i put this after I call clicked();
Do you think that this is the problem why my program freezes when i switch forms!!!
If the function is going to be called more times that shouldn't block the code it will only slow it down!!!
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
No, because if as you say the background worker works constantly irrelevant of the form being visible or not. Then the thread shouldnt ever be started or stopped accordingly. Only on creation and termination.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Jul 2008
Posts: 27
Reputation:
Solved Threads: 0
in myevent i'm comparing data and i change a color of my pictures.So this data is not shown but on the child form(instance of Form2) i have a panel and on it my drawing an graph
Graphics g = panel1.CreateGraphics();
In Myevent() i am callin an another function drawing which is drawing on panel:
drawing()
{
g.DrawLines(pen, points);
}
i am calculating points for drawing from data which i get from BGW.
and the max and average temperature which i'm collecting from BGW i'm showing also on child form:
label1.Text = max_temp;
label2.Text = average_temp;
the labels are declared in Form2 class as private:
and this is one get,set in Form2 class
public UInt16[] Alarmi_Set
{
get
{
lock (this)
{
return alarms;
}
}
set
{
lock (this)
{
alarms = value;
}
}
}
if you want i can give you all the code but there is a bunch of it and i'm trying to give you the most important stuff!!!
Graphics g = panel1.CreateGraphics();
In Myevent() i am callin an another function drawing which is drawing on panel:
drawing()
{
g.DrawLines(pen, points);
}
i am calculating points for drawing from data which i get from BGW.
and the max and average temperature which i'm collecting from BGW i'm showing also on child form:
label1.Text = max_temp;
label2.Text = average_temp;
the labels are declared in Form2 class as private:
and this is one get,set in Form2 class
public UInt16[] Alarmi_Set
{
get
{
lock (this)
{
return alarms;
}
}
set
{
lock (this)
{
alarms = value;
}
}
}
if you want i can give you all the code but there is a bunch of it and i'm trying to give you the most important stuff!!!
•
•
Join Date: Jul 2008
Posts: 27
Reputation:
Solved Threads: 0
Well yesterday i tried to do something new.After i open one of the child forms and when i wish to close it I also stop the BGW which is for that child form.And then i tried to open an another child form and I could open it and the program was still running.
The only problem is that the BGW should be running all the time and not only for a while until i close it or start it again.
Well i don't have that much of experience with C# so for now this kind of experiment doesn't tell me nothing but maybe you could know where is the problem.
The only problem is that the BGW should be running all the time and not only for a while until i close it or start it again.
Well i don't have that much of experience with C# so for now this kind of experiment doesn't tell me nothing but maybe you could know where is the problem.
![]() |
Other Threads in the C# Forum
- Previous Thread: Simpel string sorting
- Next Thread: How to sort a List of FileInfo just like in a Windows folder? (Same sort Function)
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development dll draganddrop drawing encryption enum event excel file finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile globalization httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia windows winforms wpf xml






