如何在程序启动时将我的文本框“Fahrenheit”设置为焦点,我不必手动点击它?因为程序只有一个功能,所以会更舒服。
namespace Fahrenheit
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
this.ActiveControl = textBox1;
double Fahrenheit = Convert.ToDouble(textBox1.Text);
double Celsius = (Fahrenheit - 32) * 5.0 / 9.0;
textBox2.Text = Celsius.ToString("F");
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
答案 0 :(得分:3)
行document.getElementById("textValue").value = str.slice(1,document.getElementById("textValue").value.length);
应低于this.ActiveControl = textBox1;
,如下所示:
InitializeComponent();