VB题。在文本框中输入内容,然后单击命令按钮,在文本框中输入的内容同时显示在标签和命令按钮上。
2个回答
展开全部
先假设条件为:窗体一名称为Form1,其中文本框为text1;窗体二名称为Form2,其中文本框为text1.
窗体一上面的代码为:
private Sub Text1_Change() ‘注意这里是change
Form3.Label1.Caption = Form3.Label1.Caption & Text1.Text
end Sub
窗体二上面的代码为:
private Sub Text1_Change()
Form3.Label1.Caption = Form3.Label1.Caption & Text1.Text
end Sub
这样在窗体一或者二的文本框中输入内容时,窗体三上面的label标签的内容也会随之变化啦。
窗体一上面的代码为:
private Sub Text1_Change() ‘注意这里是change
Form3.Label1.Caption = Form3.Label1.Caption & Text1.Text
end Sub
窗体二上面的代码为:
private Sub Text1_Change()
Form3.Label1.Caption = Form3.Label1.Caption & Text1.Text
end Sub
这样在窗体一或者二的文本框中输入内容时,窗体三上面的label标签的内容也会随之变化啦。
2017-05-19
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
string s;
public Form1()
{
InitializeComponent();
}
private void radioButton1_Click(object sender, EventArgs e)
{
s = textBox1.Text;
}
private void radioButton2_Click(object sender, EventArgs e)
{
s = textBox2.Text;
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = s;
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.MaxLength = 6;
textBox2.PasswordChar = '*';
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
string s;
public Form1()
{
InitializeComponent();
}
private void radioButton1_Click(object sender, EventArgs e)
{
s = textBox1.Text;
}
private void radioButton2_Click(object sender, EventArgs e)
{
s = textBox2.Text;
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = s;
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.MaxLength = 6;
textBox2.PasswordChar = '*';
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询