2022年源码C#登录注册小程序源码 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年源码C#登录注册小程序源码 .pdf》由会员分享,可在线阅读,更多相关《2022年源码C#登录注册小程序源码 .pdf(5页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、C#登录及注册的小程序1) 主界面( Form1 ) :privatevoid linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) this .Hide(); Form3 f3 = new Form3 (); f3.ShowDialog(); / 显示注册界面;privatevoid linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) this .Hide(); Form2 f = new Form2 (); f.S
2、howDialog(); if (f.DialogResult = DialogResult.OK) this .Visible = true ; / 显示登录界面;privatevoid Form1_FormClosing(object sender, FormClosingEventArgs e) try System.Diagnostics.Process myProcesses = System.Diagnostics.Process .GetProcesses(); foreach (System.Diagnostics.Process myProcess in myProcesse
3、s) if (LoginInterface.exe = myProcess.ProcessName) myProcess.Kill(); catch (Exception ee) MessageBox.Show(ee.Message); / 关掉程序;2) 注册界面( Form3 )名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 5 页 - - - - - - - - - 本文使用的数据库是sql sever2005,先在引用里加入:using System.Data.S
4、qlClient; 以下为程序代码:publicpartialclass Form3 : Form public Form3() InitializeComponent(); boolflagRegister;/ 定义标志位,确认用户注册string strConnect = Data Source=CAI-PCSQLEXPRESS;Initial Catalog=MyData1;Persist Security Info=True;User ID=sa;Password=*; / 连接数据库字符串privatevoid button1_Click(object sender, EventAr
5、gs e) if (textBox1.Text.Length = 4) & (textBox1.Text.Length = 6) & (textBox3.Text.Length = 6) flagRegister = true ; else if (textBox1.Text.Length 12) MessageBox.Show( 用户名长度不在约定范围内,请重新输入! , 提示 ); return ; if (textBox2.Text.Length 6) MessageBox.Show( 密码长度不足 6位,请重新输入!,提示 ); return ; if (textBox3.Text.L
6、ength 6) MessageBox.Show( 请重新输入邮箱!, 提示 ); return ; / 判断用户名条件;if (UserFlag = true ) MessageBox.Show( 用户已经存在,请重新输入!); return ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 5 页 - - - - - - - - - if (flagRegister = true ) / 确认用户注册后,把用户写入数据库 SqlConnection conConne
7、ction = new SqlConnection(strConnect); conConnection.Open(); string cmd = insert into 用户 (用户名 ,密码 ,email) values ( + textBox1.Text + ,+ + textBox2.Text + , + + textBox3.Text + ) ; SqlCommand com = new SqlCommand(cmd, conConnection); com.ExecuteNonQuery(); conConnection.Close(); MessageBox.Show( 注册成功
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年源码C#登录注册小程序源码 2022 源码 C# 登录 注册 程序
![提示](https://www.deliwenku.com/images/bang_tan.gif)
限制150内