📄 frmselect.cs
字号:
private void flushseat()
{
try
{
SqlDataAdapter da = new SqlDataAdapter("select * from tb_seat", con.conn);
DataTable dt = new DataTable();
da.Fill(dt);
cobDong.DataSource = dt.DefaultView;
cobDong.DisplayMember = "seat_name";
cobDong.ValueMember = "house_seatID";
}
catch (Exception ey)
{
MessageBox.Show(ey.Message);
}
}
private void flushtype()
{
try
{
SqlDataAdapter da = new SqlDataAdapter("select * from tb_type", con.conn);
DataTable dt = new DataTable();
da.Fill(dt);
cboXing.DataSource = dt.DefaultView;
cboXing.DisplayMember = "type_names";
cboXing.ValueMember = "huose_typeID";
}
catch (Exception ey)
{
MessageBox.Show(ey.Message);
}
}
#endregion
#region//after where string
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox1.Checked)
{
txtName.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@"+"house_companyName" + "@";
}
else
{
strMidle += "house_companyName" + "@";
}
this.button1.Enabled = true;
}
else
{
txtName.Enabled = false;
}
}
private void checkBox8_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox8.Checked)
{
nudYear.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_buildYear" + "@";
}
else
{
strMidle += "house_buildYear" + "@";
}
this.button1.Enabled = true;
}
else
{
nudYear.Enabled = false;
}
}
private void checkBox10_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox10.Checked)
{
txtArea.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_area" + "@";
}
else
{
strMidle += "house_area" + "@";
}
this.button1.Enabled = true;
}
else
{
txtArea.Enabled = false;
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox2.Checked)
{
cobFlood.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_floorID" + "@";
}
else
{
strMidle += "house_floorID" + "@";
}
this.button1.Enabled = true;
}
else
{
cobFlood.Enabled = false;
}
}
private void checkBox7_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox7.Checked)
{
cboXing.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" +"huose_typeID" + "@";
}
else
{
strMidle += "huose_typeID" + "@";
}
this.button1.Enabled = true;
}
else
{
cboXing.Enabled = false;
}
}
private void checkBox9_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox9.Checked)
{
cobDong.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_seatID" + "@";
}
else
{
strMidle += "house_seatID" + "@";
}
this.button1.Enabled = true;
}
else
{
cobDong.Enabled = false;
}
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox3.Checked)
{
cboFavoe.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_favorID" + "@";
}
else
{
strMidle += "house_favorID" + "@";
}
this.button1.Enabled = true;
}
else
{
cboFavoe.Enabled = false;
}
}
private void checkBox6_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox6.Checked)
{
cobZhuang.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_fitmentID" + "@";
}
else
{
strMidle += "house_fitmentID" + "@";
}
this.button1.Enabled = true;
}
else
{
cobZhuang.Enabled = false;
}
}
private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox5.Checked)
{
cobUser.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_mothedID" + "@";
}
else
{
strMidle += "house_mothedID" + "@";
}
this.button1.Enabled = true;
}
else
{
cobUser.Enabled = false;
}
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox4.Checked)
{
textBox1.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_price" + "@";
}
else
{
strMidle += "house_price" + "@";
}
this.button1.Enabled = true;
}
else
{
textBox1.Enabled = false;
}
}
private void checkBox11_CheckedChanged(object sender, EventArgs e)
{
if (this.checkBox11.Checked)
{
textBox2.Enabled = true;
if (strMidle == string.Empty)
{
strMidle += "@" + "house_ID" + "@";
}
else
{
strMidle += "house_ID" + "@";
}
this.button1.Enabled = true;
}
else
{
textBox2.Enabled = false;
}
}
#endregion
#region//user controls to control
private void ChuShiHua()
{
foreach (Control cont in this.groupBox1.Controls)
{
if (cont.GetType().ToString() == "System.Windows.Forms.TextBox")
{
cont.Text = string.Empty;
}
if (cont.GetType().ToString() == "System.Windows.Forms.ComboBox")
{
cont.Enabled = false;
}
}
}
private void unAble()
{
foreach (Control cont in this.groupBox1.Controls)
{
if ((cont.GetType().ToString() == "System.Windows.Forms.TextBox") || (cont.GetType().ToString() == "System.Windows.Forms.ComboBox"))
{
cont.Enabled = false;
}
}
}
#endregion
private void IsNum(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 8)
{
return;
}
else if (e.KeyChar == 13)
{
SendKeys.Send("{Tab}");
}
else if (e.KeyChar > '9' || e.KeyChar < '0' && e.KeyChar != '.')
{
e.Handled = true;
MessageBox.Show("无效字符");
}
}
private void txtArea_KeyPress(object sender, KeyPressEventArgs e)
{
IsNum(sender, e);
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
IsNum(sender, e);
}
private void dataGridView1_Click(object sender, EventArgs e)
{
}
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);
if (selectedRowCount > 0)
{
try
{
string str = this.dataGridView1.SelectedCells[0].Value.ToString();
if (str.IndexOf("hou") != -1)
{
frmHouse fh = new frmHouse();
fh.M_str_Show = str;
fh.ShowDialog(this);
}
str = string.Empty;
}
catch {}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -