this.textBox1.Focus(); 不管用。。。。。。。

本文介绍如何在C#中通过代码设置Windows窗体中的TextBox控件的焦点,并设置其Tab索引为0,确保用户可以直接开始输入。

this.textBox1.TabIndex = 0;
this.textBox1.Focus();

转载于:https://www.cnblogs.com/goto/archive/2012/11/07/2759006.html

private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.button1 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.tb_test_ID = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.cb_wavefoam_type = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); this.tb_test_current_value = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.tb_current_station = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.tb_current_current = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.tb_current_limit_voltage = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.tb_fail_sample_station = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.tb_pos_cycle = new System.Windows.Forms.TextBox(); this.tb_neg_cycle = new System.Windows.Forms.TextBox(); this.tb_osc_source = new System.Windows.Forms.TextBox(); this.pb_current_wavefoam = new System.Windows.Forms.PictureBox(); this.label8 = new System.Windows.Forms.Label(); this.tb_current_wavefoam_time = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.pb_set_logo = new System.Windows.Forms.PictureBox(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.sp_connect_PLC = new System.IO.Ports.SerialPort(this.components); this.btn_connect_oplc = new System.Windows.Forms.Button(); this.label14 = new System.Windows.Forms.Label(); this.PLC_String = new System.Windows.Forms.TextBox(); this.tb_wavefoam_qty = new System.Windows.Forms.TextBox(); this.station_1_count = new System.Windows.Forms.TextBox(); this.station_2_count = new System.Windows.Forms.TextBox(); this.station_3_count = new System.Windows.Forms.TextBox(); this.station_4_count = new System.Windows.Forms.TextBox(); this.station_5_count = new System.Windows.Forms.TextBox(); this.工位1次数 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.tb_current_limit_voltage_neg = new System.Windows.Forms.TextBox(); this.label21 = new System.Windows.Forms.Label(); this.tb_current_current_neg = new System.Windows.Forms.TextBox(); this.label22 = new System.Windows.Forms.Label(); this.tb_limit_voltage_value = new System.Windows.Forms.TextBox(); this.label23 = new System.Windows.Forms.Label(); this.label24 = new System.Windows.Forms.Label(); this.label25 = new System.Windows.Forms.Label(); this.btn_clean_next_oder = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pb_current_wavefoam)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pb_set_logo)).BeginInit(); this.SuspendLayout();
最新发布
06-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值