J
Jim Heavey
Hello, hoping you can clear up a little bit of confusion that I have on
creating/using static methods.
I want to create a class which hold all my "Utility Methods" for windows
forms. So I created a new project and added that project to my existing
project. The project "type" I selected was a "Class Library". What
this a correct choice.
So if I want to create "Static" methods, does the class itself have to
be static? There is no real reason to instatiate the class, so I am
guessing that I should make the class static. When I attempt to do
this, it tells me the modifier is not valid for this item. Have I got
the wrong format, or the wrong idea? Here is my code...
namespace WindowFormsUtilities
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public static class WindFormUtilities
{
public static WindFormUtilities()
{
//
// TODO: Add constructor logic here
//
}
public static bool SetComboBoxSelectionError(ComboBox cbo,
ErrorProvider err)
{
}
private bool[] SetComboBoxSelectionError (ComboBox[] cbo,
ErrorProvider err)
{
}
}
}
creating/using static methods.
I want to create a class which hold all my "Utility Methods" for windows
forms. So I created a new project and added that project to my existing
project. The project "type" I selected was a "Class Library". What
this a correct choice.
So if I want to create "Static" methods, does the class itself have to
be static? There is no real reason to instatiate the class, so I am
guessing that I should make the class static. When I attempt to do
this, it tells me the modifier is not valid for this item. Have I got
the wrong format, or the wrong idea? Here is my code...
namespace WindowFormsUtilities
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public static class WindFormUtilities
{
public static WindFormUtilities()
{
//
// TODO: Add constructor logic here
//
}
public static bool SetComboBoxSelectionError(ComboBox cbo,
ErrorProvider err)
{
}
private bool[] SetComboBoxSelectionError (ComboBox[] cbo,
ErrorProvider err)
{
}
}
}