So I have this bit of code, that for some reason won't compile, because it says I am using a method as a type.... I for some odd reason can't see what it is that is supposed to be wrong, the only article google gave me, was an article here that is less than useless.
So my question is, what is wrong with this code:
static void Main() {
Application.Run(new stat_checker());
}
public stat_checker() {
}
Well, you're calling new on it, so it looks like you want to declare a type called stat_checker:
public class stat_checker : Form
{
}
Alternatively, if you wanted to call stat_checker you'd need to write:
Application.Run(stat_checker());
But you also need to change stat_checker to be a valid type:
public Form stat_checker() {
// Return something here
}
Were you trying to include this code within a type called stat_checker? If so, it should already work:
using System;
using System.Windows.Forms;
class stat_checker : Form {
static void Main() {
Application.Run(new stat_checker());
}
public stat_checker() {
}
}
If you could tell us which of these scenarios you're actually trying to achieve, that would help. I'd also suggest that you start following .NET naming conventions, e.g. using StatChecker instead of stat_checker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With