For the concerning of current instance of Form1, following is one of the various ways to pass the current instance when instantiate myclassnamespace Calculator { public partial class Form1: Form { public Form1() { InitializeComponent(); textBox1=textBox2; // demonstration for "static make sense" var x=new Form1.myclass { form1=this }; // now x.textBox3 is reference to textBox2 } public class myclass { TextBox textBox3=Form1.textBox1; TextBox textBox4; internal Form1 form1; public myclass() { // form1=new Form1(); textBox4=form1.textBox2; } } static public System.Windows.Forms.TextBox textBox1; public System.Windows.Forms.TextBox textBox2; }} 这篇关于文本框对象参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-01 09:22