How to make Global functions for many classes in C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created control array classes for buttons and textboxes and affixed
them to a form class. In VB I can easily create a module with fuctions that
can be accessed from any class. How can I do the same in C#? When I use the
'Static' keyword I get an error.

For example when I try to change the BackColor of an instance of a TextBox
object on the form from a ButtonArray class event handler function also on
the form I get this error: "An object reference is required" . I think it
wants me to create another instance of the TextBox array which means I will
be working with different objects.

I'm looking to create a bucnch of fuctions that can pass values and change
other object properties.

I can't figure this one out. Its probably very simple but I've just been
made stupid from using vb for so long.

Poe
 
Fri. Aug. 20, 2004 11:10 AM PT

Try creating a global, class, and add all your globals (functions, fields,
variables, properties) as static in this class, or create a SingleTon class,
and also, this will allow you to use Static, and instance members of the
class, Instantiate this object, in your main function.

Good Luck.!!!
 
Back
Top