winform -tab选项切换dropdownlist值不变
来源:互联网 发布:超星尔雅网络课程登陆 编辑:程序博客网 时间:2024/05/20 14:26
{
partial class Form14
{
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows フォーム デザイナで生成されたコード
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"11111111",
"22222222",
"33333333"});
this.comboBox1.Location = new System.Drawing.Point(3, 6);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 20);
this.comboBox1.TabIndex = 0;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// comboBox2
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"555555",
"666666",
"777777"});
this.comboBox2.Location = new System.Drawing.Point(3, 6);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(121, 20);
this.comboBox2.TabIndex = 1;
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(258, 112);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(186, 108);
this.tabControl1.TabIndex = 2;
this.tabControl1.Click += new System.EventHandler(this.tabControl1_Click);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.comboBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(178, 82);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.comboBox2);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(178, 82);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
// Form14
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(501, 356);
this.Controls.Add(this.button1);
this.Controls.Add(this.tabControl1);
this.Name = "Form14";
this.Text = "Form14";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace WindowsApplication1
{
public partial class Form14 : Form
{
public Form14()
{
InitializeComponent();
}
private bool bo1 ;
private bool bo2;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
bo2 = true;
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
bo1= true;
}
private void tabControl1_Click(object sender, EventArgs e)
{
switch (tabControl1.SelectedTab.Name)
{
case"tabPage1":
if (bo1)
{
comboBox1.Enabled = false;
}
else
{
comboBox1.Enabled = true;
bo2 = false;
comboBox2.SelectedIndex = -1;
}
break;
case "tabPage2":
if (bo2)
{
comboBox2.Enabled = false;
}
else
{
comboBox2.Enabled = true;
bo1 = false;
comboBox1.SelectedIndex = -1;
}
break;
}
}
}
}
comboBox 自动左边加输入的数值
private void comboBox1_Leave(object sender, EventArgs e)
{
string aa = comboBox1.Text;
this.textBox2.Text = aa.Split('|')[1];
comboBox1.Text = aa.Split('|')[0];
}
- winform -tab选项切换dropdownlist值不变
- Tab选项卡切换
- Tab选项卡切换
- Tab选项卡切换
- 选项卡Tab切换
- jquery tab选项卡切换
- tab选项卡切换问题
- tab选项卡切换效果
- 切换选项卡tab效果
- jq tab选项卡切换
- tab选项卡切换代码演示
- Tab选项卡切换效果JavaScript汇总
- js栏目切换 模仿tab选项卡
- Axure实现Tab选项卡切换功能
- javascript实现的tab选项卡切换
- 点击切换的萌萌哒tab选项卡
- tab -选项卡切换js效果
- tab标签(选项卡)切换实现
- linux命令之grep
- C/C++定义全局变量/常量几种方法的区别
- Linux环境进程间通信(三):消息队列
- new/delete 和malloc/free 的区别
- ubuntu下安装bochs
- winform -tab选项切换dropdownlist值不变
- IOS修改键盘颜色
- struts <s:url> 中文
- Android正则表达式
- 豆腐小常识
- Oracle 集合类型介绍
- VC API常用函数简单例子大全
- 详解Objective-c Block应用
- Linux环境进程间通信(四):信号量