level 1
白泽修
楼主
public Form1()
{
InitializeComponent();
String[] ss = new string[64];
for (int i = 0; i < 64; i++)
{
ss[i] = i.ToString();
}
comboBox3.DataSource = ss;
comboBox1.SelectedIndex = 3;
comboBox2.SelectedIndex = 1;
}
}
private void button1_Click(object sender, EventArgs e)
{
int i = int.Parse(comboBox1.Text);
int j = int.Parse(comboBox2.Text);
if (button1.Text == "打开串口")
{
if (setupcom(i, j) == 0)
{
MessageBox.Show("Failed!");
}
else
{
button1.Text = "关闭串口";
MessageBox.Show("Open success!");
}
}
else
{
closecom();
button1.Text = "打开串口";
}
}
private void button2_Click(object sender, EventArgs e)
{
// byte[] mybyte = new byte[4];
//// StringBuilder ybyte = new StringBuilder();
// int mak = CHECK_CARD(mybyte);
// int m =
// if (mak >= 0x400)
// {
// string msg = "";
// for (int i = 0; i < 4; i++)
// {
// msg += mybyte[i].ToString("X") + " "; //这边使用的是Byte的类型,而且成功的
// }
// // MessageBox.Show(msg);
// textBox1.Text = msg;
// }
// else
// {
// textBox1.Text = "";
// }
}
怎么改成自动读卡?就是卡放到读卡器那里,就可以自动打开串口并读卡。
2013年12月12日 07点12分
1
{
InitializeComponent();
String[] ss = new string[64];
for (int i = 0; i < 64; i++)
{
ss[i] = i.ToString();
}
comboBox3.DataSource = ss;
comboBox1.SelectedIndex = 3;
comboBox2.SelectedIndex = 1;
}
}
private void button1_Click(object sender, EventArgs e)
{
int i = int.Parse(comboBox1.Text);
int j = int.Parse(comboBox2.Text);
if (button1.Text == "打开串口")
{
if (setupcom(i, j) == 0)
{
MessageBox.Show("Failed!");
}
else
{
button1.Text = "关闭串口";
MessageBox.Show("Open success!");
}
}
else
{
closecom();
button1.Text = "打开串口";
}
}
private void button2_Click(object sender, EventArgs e)
{
// byte[] mybyte = new byte[4];
//// StringBuilder ybyte = new StringBuilder();
// int mak = CHECK_CARD(mybyte);
// int m =
// if (mak >= 0x400)
// {
// string msg = "";
// for (int i = 0; i < 4; i++)
// {
// msg += mybyte[i].ToString("X") + " "; //这边使用的是Byte的类型,而且成功的
// }
// // MessageBox.Show(msg);
// textBox1.Text = msg;
// }
// else
// {
// textBox1.Text = "";
// }
}
怎么改成自动读卡?就是卡放到读卡器那里,就可以自动打开串口并读卡。