romanhoehne Posted January 5, 2004 Posted January 5, 2004 (edited) Hello, I have a Problem: In my MainWindows I can easy access the Control - it ist simply "this". In my MainWindow I use a Class DrawingUtils an this class use other classes like Figure, witch should be draw: class Figure public void Draw (Control control) {Rectangle destination = new Rectangle(0,0,96,96); destination.Location=control.PointToScreen(new Point(360,360)); . . . class DrawingUtils private void CreateSurfaces(Control control) { _display = new Device(); _display.SetCooperativeLevel(control, CooperativeLevelFlags.Normal); How can I access the Control from my Mainwindow in a Class? I do not want to use Parameters like "(Control control)". Is there a way to access it from those classes? Thank You a lot, Roman Edited January 5, 2004 by romanhoehne Quote
AlexCode Posted January 7, 2004 Posted January 7, 2004 Usually, when I want to do something like this, I declare the forms in a Module. I don't instanciate them... just declare... Module Forms Dim FormMain as System.Windows.Forms.Form 'This will start the app with this form... Public Sub Main Application.Run(New FormMain) End Sub End Module 'If you have a class in this project and want to access the objects on the FormMain you just have to call this: 'Lets assume you want to access a TextBox on thet Form called TextBox1... MessageBox.Show(Forms.FormMain.TextBox1.Text) Alex :D Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.