用户登录窗口设计出了问题 在校大三学生求教
做窗口设计的时候出现如下问题 代码如下:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 登陆窗口
{
public partial class 登陆界面 : Form
{
public 登陆界面()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
textBoxUserName.MaxLength = 10;
textBoxPassword.PasswordChar = '*';
toolTip1.InitialDelay = 0;
toolTip1.ReshowDelay = 0;
toolTip1.SetToolTip(textBoxUserName, "用户名不能超过10个字符,而且只能是汉字、字母和数字 ");
toolTip1.SetToolTip(textBoxPassword, "密码不能少于5个字符,而且只能用字母和数字 ");
toolTip1.SetToolTip(ButtonOK, "单击显示用户输入的姓名和密码");//
errorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink;
}
private void textBoxPassword_TextChanged(object sender, EventArgs e)
{
textBoxPwdMessage.Text = textBoxPassword.Text;
}
private void Botton_Click(object sender, PopupEventArgs e)
{
MessageBox.Show("用户名: ", +textBoxUserName.Text, "密码: " + textBoxPassword.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void textBoxUserName_Validating(object sender, EventArgs e)
{
ValidatingText(textBoxUserName,"用户名包含了非汉字、字母和数字的字符 ");
}
private void textBoxPassword_Validating_(object sender, EventArgs e)
{
bool isValid = ValidatingText(textBoxPassword,"密码包含非汉字、字母和数字的字符 ");
if(isValid)
{ if(textBoxPassword.Text .Length < 5)
{
errorProvider1 .SetError (textBoxPassword ,"密码长度小于5");
}
else
{
errorProvider1 .SetError (textBoxPassword ,string .Empty);
}
}
}
private bool ValidatingText(TextBox textbox, string errorMessage)
{
string s = textbox.Text ;
bool isValid = true ;
for (int i = 0;i<s.Length ;i++)
{
if(char .IsLetterOrDigit (s[i ])==false )
{
errorProvider1 .SetError (textbox ,errorMessage );
isValid = false ;
break ;
}
}
if(isValid) errorProvider1 .SetError (textbox ,string .Empty );
return isValid ;
}
}
} --------------------编程问答-------------------- 兄弟,发错板块了 --------------------编程问答-------------------- c#语言的吧。
有没有连数据库
出什么问题。什么问题?? --------------------编程问答-------------------- 你的代码要实现什么功能啊 ~~~
登录吗~~~ 那账户密码要怎么对上 数据库么~~~
--------------------编程问答-------------------- 什么问题?? --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 什么问题???? --------------------编程问答-------------------- MainForm_Load这个函数名错了。
改成
登陆界面_Load --------------------编程问答-------------------- 我还以为我是菜鸟呢,原来我不是太菜的菜鸟。 --------------------编程问答-------------------- 问题在哪呢???
补充:.NET技术 , 其他语言