关于控件访问的问题
定义了个新类,想通过新类访问文本框,结果发现内容不显示。public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void WriteMsg(string msg)
{
txt_Msg.AppendText(msg + "\n"); //向文本框中追加数据
}
private void btn_Start_Click(object sender, EventArgs e)
{
B b = new B();
b.test();
}
}
public class b
{
Form1 frm = new Form1();
public void test()
{
frm.WriteMsg("abc");
}
} --------------------编程问答-------------------- 谁来帮帮菜鸟阿 --------------------编程问答-------------------- 呵呵 帮顶! --------------------编程问答-------------------- 没人知道什么原因吗?
自己顶个 --------------------编程问答-------------------- txt_Msg.AppendText(msg + "\n"); //向文本框中追加数据
---------------------------
1.txt_Msg是一个TextBox?
2.为什么末尾要加"\n"?
3.TextBox是多行的? --------------------编程问答-------------------- 你Main函数呢,写全,再来说话,这样 我好看明白点,
一般来说你至少要 建立 winform消息循环吧,使用
Form.Show();
或
Application.Run(new Form1());
--------------------编程问答-------------------- 1.txt_Msg是TextBox
2.TextBox是多行的
补充:.NET技术 , C#