📄 customerform.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class CustomerForm : Form
{
public CustomerForm()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
customerDataSet1.Clear();
sqlDataAdapter1.Fill(customerDataSet1);
}
private void button1_Click(object sender, EventArgs e)
{
bool flag;
flag = true;
if (textBox1.Text == "")
{
MessageBox.Show("please specify a valid car number");
flag = false;
}
else
if (textBox2.Text == "")
{
MessageBox.Show("please specify a valid address");
flag = false;
}
else
if (textBox3.Text == "")
{
MessageBox.Show("please specify a valid name");
flag = false;
}
else
if (textBox4.Text == "")
{
MessageBox.Show("please specify a valid make");
flag = false;
}
else
if (flag == false)
return;
else
{
sqlDataAdapter1.Update(customerDataSet1);
MessageBox.Show("Database updated!!!");
}
}
private void button2_Click(object sender, EventArgs e)
{
customerDataSet1.Clear();
sqlDataAdapter1.Fill(customerDataSet1);
}
private void button4_Click(object sender, EventArgs e)
{
this.Close();
}
private void button5_Click(object sender, EventArgs e)
{
btnBack.BindingContext[customerDataSet1, "tblCustomer"].Position -= 1;
CurrentPosition();
}
private void btnNext_Click(object sender, EventArgs e)
{
btnBack.BindingContext[customerDataSet1, "tblCustomer"].Position += 1;
CurrentPosition();
}
private void CurrentPosition()
{
int currentPosition, ctr;
ctr = this.BindingContext[customerDataSet1, "tblCustomer"].Count;
if (ctr == 0)
{
textBox5.Text="数据库中无数据!!!";
}
else
{
currentPosition = this.BindingContext[customerDataSet1, "tblCustomer"].Position + 1;
textBox5.Text=currentPosition.ToString() + "of" + ctr.ToString();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -