For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
If you're talking about how many instances of your application are running, that's not going to work. You have to count the number of processes that are running using the process name of your application and the Process class.
If you're talking about how many instances of a class you have inside a single instance of a running application, that code may work.
There is no problem - the code is doing exactly what you've told it to!
You increment the Counter variable each time you create a new instance of the Program class. However, you never create an instance of the Program class - you just declare two variables which could potentially hold an instance of that class in the future.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
The problem is that in this case, you aren't creating any instances of your class, just the variables to hold instances. If Program was a struct rather than a class, then
would create instances - but they still wouldn't increment your counter, because value type constructions aren't implicitly called.
Program b = new Program();
Program c = new Program();
And your counter will be incremented as you expect because you are creating instances.
A variable isn't the same as an instance: think of a variable as a "parking space" - it can hold any Car object, but you can't drive the space down to the shops! The parking space is the variable, the instance is the actual Car it holds.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
staticvoid Main(string args)
var a = new App();
var b = new App();
Needless to say that abusing it as a global variable is an anti-pattern. I don't know what you are trying to do, but this seems like the wrong way.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
hello every one,
I have a problem with my program,
I can select a image from one folder in open dialog but I can't move the image to be processed in another directory.
so pleas help me..
this is my program
public partial class Form1 : Form
private TransferFile transferFile = new TransferFile();
hello,i have question as follows.
for example, I want to call fun1, then introduce vary x, and function as vary(fun2 or fun3), fun2 and fun3 have different varies. In fun1, can call fun2 or fun3 according to reference.
I think delegate can solve it ,but fun2 and fun3 have different number input, how to do it?
delegate void call() //?
fun2(y) or fun3(y,z)?
This code makes no sense: you call method 'fun1 with two arguments, but method 'fun1 takes no parameters. All your methods, and the delegate, are defined outside the scope of the Main method: what is the enclosing Class ?
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
i am sorry,indeed i am a beginner.
I don't know how to meet my requirement. My requirement as follows:
I want to code an optimization algrithm function to calculate Minimized value. It can input function that needed optimization, like fun2 or fun3 ,etc... that i said. It means if i input fun2 to optimization function ,it can search fun2's Minimized value, if input fun3, it can search fun3's Minimized value.But fun2 and fun3 or other functions don't have same style input variable,their input variable style and number is not same.
how can i realize it?
Thank you very much,it 's near my requirement.
But one more requirement is that:
static void fun1(int x, Action call)
take fun3(y,z) for example, call() is run fun3(y,z).
but if i want to run fun3(x,z) ,how to realize it? you know ,i want to change y value in fun1 to call fun2(int y) or fun3(int y,int z),because my code use loop to change y value in fun1,to let fun2 or fun3 be a minimum value.
Great Job!!! Thank you very much.
And i have other question bothering me.
I have to use chart control to plot 10 series including 1000 points per series in one chartarea. But after ploting, mouse move or zoom in or ContextMenuStrip operation is very slow and delay. I think maybe paint problem.
When i ask before, i get the answer is point number is too big.
But i found that if i plot 200 series with 1 point for example as follows, the operation is also slow. How can treat it?