Using Controls in Classes [modified]
-
Hi I can't use controls like TextBox or DataGridView in simple Class which i added it from Solution Explorer to my project. It seems that needs System.Windows.Form namespace. My problem is this : Class should inherits from "Form Class" for identifying controls and in this case its behavior converts to Form behavior.
using System.Windows.Form; . public class MyClass : Form { }
Is there another way to using controls in class without Inheriting from Form? Tanx -
Hi I can't use controls like TextBox or DataGridView in simple Class which i added it from Solution Explorer to my project. It seems that needs System.Windows.Form namespace. My problem is this : Class should inherits from "Form Class" for identifying controls and in this case its behavior converts to Form behavior.
using System.Windows.Form; . public class MyClass : Form { }
Is there another way to using controls in class without Inheriting from Form? TanxYou class doesn't need to inherit form Form class to recognize the Controls classes, yet it has to inherit from Form class to display those controls as a windows form, unless you got another way of displaying them. Simply add a using System.Windows.Forms; statement to the top of the file, and all Controls -eg. TextBox, ComboBox, etc...- should be recognizable in your code.
Regards:rose: