代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace frmRegister
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.cmbCity.Items.Add("北京");
this.cmbCity.Items.Add("上海");
this.cmbCity.Items.Add("天津");
this.cmbCity.Items.Add("重庆");
this.cmbCity.Items.Add("广州");
this.cmbCity.Items.Add("南京");
this.rdoMale.Checked = true;
}
private void txtAge_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar != 8 && !char.IsDigit(e.KeyChar)) && e.KeyChar