您的位置:首页 > 编程语言 > C#

C#窗体应用 电子杂志注册会员代码

2010-03-29 08:34 661 查看
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 WindowsFormsApplication48
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void textBox2_TextChanged(object sender, EventArgs e)
{
this.textBox2.PasswordChar = '*';

}

private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.Yellow ;

comboBox1.Items.Add("北京");
comboBox1.Items.Add("天津");
comboBox1.Items.Add("河北");
comboBox1.Items.Add("上海");
comboBox1.Items.Add("江西");
comboBox1.Items.Add("湖北");
comboBox1.Items.Add("湖南");
comboBox1.Items.Add("山西");
comboBox1.Items.Add("辽宁");
comboBox1.Items.Add("福建");
comboBox1.Items.Add("山东");
comboBox1.Items.Add("黑龙江");
comboBox1.Items.Add("其他");

}

private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
richTextBox1.Text = "用户名不能为空";
else if (textBox2.Text == "")
richTextBox1.Text = "密码不能为空";
else if (listBox1.Text == "")
richTextBox1.Text = "请选择兴趣爱好";

else if (!checkBox1.Checked)
richTextBox1.Text = "如不同意会员条款,您将不能注册";
else
{
StringBuilder sb = new StringBuilder("注册成功!");
sb.Append("/r/n用户名:");
sb.Append(textBox1.Text);
sb.Append("/r/n密码:");
sb.Append(textBox2.Text);
sb.Append("/r/n请妥善保管您的注册信息");

richTextBox1.Text = sb.ToString();
}
}

private void button2_Click(object sender, EventArgs e)
{
this.Close();
}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: