资源描述:
《vb实验答案(正品)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、2--1界面如下:程序如下:ImportsSystem.DataImportsSystem.Data.OleDbPublicClassForm1DimRight_Name,Right_MimaAsStringDimiAsInteger=0'i为输入的次数DimYonghm,MimaAsStringPublicStructureMuneDimRight_NameAsStringDimRight_MimaAsStringEndStructureDimM(10)AsMuneDimjAsInteger=0PrivateSubForm2_Load(ByValsend
2、erAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load'11111DimcnAsNewOleDbConnection()cn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:test.mdb"'22222DimcmdAsNewOleDbCommand()cmd.Connection=cncmd.CommandText="select*fromUsers"'33333333DimdaAsNewOleDbData
3、Adapterda.SelectCommand=cmd'44444DimdtAsNewDataTable'5555555555cn.Open()da.Fill(dt)'用适配器来填充数据集合cn.Close()ForEachdrAsDataRowIndt.RowsM(j).Right_Name=dr.Item(1).ToStringM(j).Right_Mima=dr.Item(2).ToStringj=j+1NextEndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSyste
4、m.EventArgs)HandlesButton1.ClickDimyonghm1AsStringyonghm1=Strings.RTrim(TextBox1.Text)Mima=TextBox2.Text'Ifi=3And(Yonghm<>Right_NameOrMima<>Right_Mima)Then'End'EndIf'Ifyonghm1=Right_NameAndMima=Right_MimaThen'Me.Hide()'MessageBox.Show("你好,"&Right_Name&"欢迎使用此软件!")'ElseIfyonghm1<>Ri
5、ght_NameThen'MessageBox.Show("登录信息错误,请检查后重新输入!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)'TextBox1.SelectAll()'TextBox1.Focus()'i=i+1'ElseIfyonghm1=Right_NameAndMima<>Right_MimaThen'MessageBox.Show("登录信息错误,请检查后重新输入!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamation
6、)'TextBox2.SelectAll()'TextBox2.Focus()'i=i+1'EndIfDimxAsIntegerDimyAsIntegerDimzAsBoolean=FalseDimqAsBoolean=FalseForx=0ToM.Length-1Ifyonghm1=M(x).Right_NameThenz=TrueExitForEndIfNextIfz=FalseThenMessageBox.Show("登录信息错误,请检查后重新输入!","提示",MessageBoxButtons.OK,MessageBoxIcon.Exclamat
7、ion)TextBox1.SelectAll()TextBox1.Focus()i=i+1z=TrueIfi=3ThenEndEndIfExitSubEndIfIfz=TrueThenFory=0ToM.Length-1IfMima=M(y).Right_MimaThenMe.Hide()MessageBox.Show("你好,"&Right_Name&"欢迎使用此软件!")q=TrueExitForEndIfNextEndIfIfq=FalseThenMessageBox.Show("登录信息错误,请检查后重新输入!","提示",MessageBoxBu
8、ttons.OK,MessageBoxIcon.Exclamati