.net - Visual C# - Missing partial modifier -
i error saying "missing partial modifier on declaration of type 'projectname.main'; partial declaration of type exists. can read error, because have classes same name. work if modify main class public partial class main : form want know why gives me error. need initializecomponent within main(), tried creating method start() , calling main.start() in load event, form loads blank.
namespace projectname { public class main : form { public main() // method: starts main form { initializecomponent(); } public void main_load(object sender, eventargs e) // on load of main class, handle events , arguments { main main = new main(); main.getcurrentdomain(); } public void getcurrentdomain() // method: current domain { domain domain = domain.getcurrentdomain(); } } // ends main class }
assuming windows forms app, problem visual studio winforms designer has created file (e.g. main.designer.cs
) with:
public partial class main : form
to contain designer-generated code.
your partial class source merged - can only happen when both source files declare class partial
. otherwise, you're trying declare 2 classes same name in same namespace, prohibited c#.
Comments
Post a Comment