Expose class members (how to)

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

Guest

Hello. I have write a class file with some methods I wish to expose. For
example I have a windows form which should call a method from another class
file. I think this has something to do with inheritance, no? Maybe the
windows form will need to inherit from class file? I use C# 05. Thank you
 
public class ExposesStuff {
public void ExposedMethod() {
Console.WriteLine("ExposesStuff:ExposedMethod");
}
}

then elsewhere in code ...

ExposesStuff MyExposesStuff = new ExposesStuff();
MyExposesStuff.ExposedMethod();

also you have to make sure they are either in the same namespace or you have
included a "using xxxxxx;" where you use the class.

Cheers,

Greg
 
Greg. Thanks that got me closer to what I needed. I can now call the
methods in the base class. What I struggle to do now is to bind a
datagridview on the form to the datatable that is created by the method in
the base class. The method in base class creates a dataset with only 1
table. Should the datatable be returned as a field type in the base class?
What do you suggest?

toco
 
Back
Top