下面是我在textbox6上尝试的内容,但什么也没发生。我甚至尝试将tableindex更改为0,但是没有!
private void button30_Click(object sender, EventArgs e)
{
groupBox1.Enabled = false;
groupBox2.Enabled = false;
groupBox3.Enabled = false;
groupBox4.Enabled = false;
groupBox5.Enabled = false;
groupBox6.Enabled = false;
groupBox7.Enabled = false;
groupBox8.Enabled = false;
label21.Enabled = false;
label22.Enabled = false;
label23.Enabled = false;
label11.Visible = true;
**textBox6.Visible = true;**
textBox6.Select(0, 0);
button31.Enabled = true;
button30.Enabled = false;
button30.BackColor = Color.Red;
}
启用按钮30
的单击事件后,下面的代码将光标定位在文本框6
内。
private void button30_Click(object sender, EventArgs e)
{
textBox6.Select();
}
以下应用程序包含FormTest中的摘要代码。从FormTest.cs文件中esigner.cs可能导致错误的文件和应用程序代码:
/* FormTestDesigner.cs */
namespace WinFormsApp
{
partial class FormTest
{
private void InitializeComponent()
{
/* Elements */
this.enterButton = new System.Windows.Forms.Button();
this.inputTextBox = new System.Windows.Forms.TextBox();
/* Button */
this.enterButton.Click += new System.EventHandler(this.enterButton_Click);
/* Form */
this.Controls.Add(this.inputTextBox);
this.Controls.Add(this.enterButton);
}
/* Controls */
private System.Windows.Forms.Button enterButton;
private System.Windows.Forms.TextBox inputTextBox;
}
}
using System.Windows.Forms;
namespace WinFormsApp
{
public partial class FormTest: Form
{
public FormTest()
{
InitializeComponent();
}
private void enterButton_Click(object sender, EventArgs e)
{
inputTextBox.Select();
}
}
}