Class Function in WinForms project
"R. Rogers" <[email protected]> Mon, 29 Oct 2007 11:04:21 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <002901c81a3c$fd08a020$6800a8c0@Speedster> |
Hi everyone,
I have a very simple form that allows the user to select an upload type from
a combo box, then either click on ok or cancel. The main form calls the
UploadType form as so:
frm_GetUploadType frmGetUploadType = new
frm_GetUploadType();
if frmGetUploadType.ShowDialog() == DialogResult.OK
{
UserSelectedUploadType = frmGetUploadType.UploadType;
...
}
I don't want the calling form to have to instantiate, check, and get the
upload type.
I want a class method/constructor to do all that for me.
I've begun doing that by writing this simple code for the in the
frm_GetUploadType class:
public static UploadTypes GetUploadType(ref bool OKClicked)
{
}
I have three questions:
. I believe I should be doing this in a static method, not a static
constructor; constructors only get called when an instance is created. Is
this true?
. I call these class methods, from a previous language, but are they called
that in C#?
. Why am I getting a CS0050 compile error? Inconsistent accessibility:
return type 'type' is less accessible than method 'method'
Thank you for any help you can provide.
Richard Rogers
http://www.RichardRogers.ca/