我将值从方法传递到窗体构造函数和textbox,但它没有显示在textbox中。请帮帮忙
myhub.cs
public void sendtoserver(string msg)
{
Clients.Caller.stos(msg);
Form1 frm = new Form1(msg);
}
public Form1(string msg)
{
InitializeComponent();
textBox1.Text = msg;
}
发布于 2017-02-28 14:06:30
不需要为Form1创建实例,因为您已经在表单上了,只需将msg分配给textBox1即可。
public void sendtoserver(string msg)
{
Clients.Caller.stos(msg);
textBox1.Text = msg;
}
发布于 2017-02-28 14:01:40
你也得出示表格。
Form1 frm = new Form1(msg);
frm.Show();
https://stackoverflow.com/questions/42510665
复制相似问题