|
can anyone help me with this please?
|
|
|
|
|
Hi All,
i'm trying to write a program where the button1_Click event will start a new thread and everything within the button1_Click runs within this thread, rather than starting new threads within the button1_Click.
so, i want this:
thrd_1 = new Thread(new ThreadStart(button1_Click));
private void button1_Click(object sender, eventArgs e)
{
things to do 1
things to do 2
}
rather than
private void button1_Click(object sender, eventArgs e)
{
thrd_1.start()
thrd_2.start()
}
i hope this makes sense!
Many thanks,
Phil
|
|
|
|
|
so what exactly is your question? from what it looks like you already have the answer.
Prateek
|
|
|
|
|
Hi, thanks for replying so quickly.
the problem is it won't compile. it errors saying - No overload for button1_Click matches delegate 'System.Threading.ThreadStart.
|
|
|
|
|
You must do it like in the second solution, the first one won't work.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The error message explains it...
The ThreadStart delegate looks like this:
public delegate void ThreadStart()
Are you looking for something like this?
private void button1_Click(object sender, eventArgs e)
{
thrd_1 = new Thread(new ThreadStart(button1_Clickthread));
thrd_1.start()
}
private void button1_Clickthread()
{
things to do 1
things to do 2
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how to create simple animations using the Visual studio 2008
|
|
|
|
|
WPF provides built in support for animation.
|
|
|
|
|
do you have some flash files that you are going to use?
Cheers!!
Brij
|
|
|
|
|
Using visual studio? You mean you want to animate the IDE or do you want to write a program, using vS 2008, that does animation?
If the former - I have no idea.
If the latter - more info please! I'm guessing C# (as this would be the right forum) but what do you want to do? Bounce a ball around the form? MOve a label up and down? Show an AVI?
If I knew then what I know today, then I'd know the same now as I did then - then what would be the point?
.\\axxx
(That's an 'M')
|
|
|
|
|
I have a requirement to display all the application programs started by a user during a specific time period.
I don't want to list all the processes currently running.
Only the programs explicitly invoked by a user such as opening a notepad, control panel, my computer properties, internet explorer, ms word etc.
Is this achievable?
thanks in advance
Fadi
|
|
|
|
|
How does your problem relate to C#?
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
The requirement is part of the c# application which i am currently working on.
If you feel it should have been some posted in some other section, pls suggest it.
|
|
|
|
|
Member 3467902 wrote: working on.
so what have you done so far?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Thanks alot..... I will try like that......
|
|
|
|
|
You are welcome
|
|
|
|
|
Hello aLL,
I am trying to create windows form on the fly by looking at the value coming in form of a string.
for example:- i have form by name frmMain i will be getting this name from a string during runtime.
I am not getting how to create an instance of an object of type frmMain
Thanks in Advance
Regards
Bharath
Ron
|
|
|
|
|
Look into System.Type.GetType ( name )
|
|
|
|
|
|
Hi,
I've made a screen saver in C#, and everything works out fine. The only thing that bothers me is the noise made by my computer while the screen saver is running. A few seconds after it comes on, the computer begins whirring and making a lot of noise... This problem is fixed when I increase the interval for my Timer object, but the animation becomes choppy. I would be perfectly happy with the screen saver if I could just get the darn computer to stop whirring... Any suggestions you guys?
Thanks,
Max
|
|
|
|
|
Can you figure out what is whirring?
1) Hard drive?
2) Cd/Dvd drive?
3) Fans?
Most likely culprit is that you are loading something from disk (like your images for your animation maybe?) and you're doing this every frame of the animation.
Check and make sure you are only loading from disk once at the beginning.
Simon
|
|
|
|
|
Thanks to all, I'm sorry I wasn't as concise as I should have been... A few seconds after the screen saver pops up after the set time of 1 minute, there is a whirring sound from the back of my CPU. It is a desktop computer, and I'm not completly sure, Simon, what it is that's making the sound. If I had to guess, I'd guess the hard drive, but I'll check again once I get home.
Your suggestion that I was loading an image on every frame of animation was one that I had thought of, unfortunately... I am loading several images, however these are loaded at the beginning. Would drawing these images on every frame have the same effect? I have double buffered the form and my timer has an interval of 2, I believe... This is rather fast but I want the animation to be smooth...
The only reason the whirring is a problem for me is that I don want to turn the screen saver off every time I go to sleep haha.
|
|
|
|
|
Does this happen with all screen savers or just yours?
If it happens with all it could be that you have indexing set up to run while the screen saver is active. Or some other similar task.
Simon
|
|
|
|
|
Only happens with mine... Hmm...
|
|
|
|