Dim tx1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim user As String=tx1.text
Dim sss As String=e.Form.Controls("ComboBox2").text
Dim tx2 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim pows As String=tx2.text
Dim dl As WinForm.Button = e.Form.Controls("Button1")
Dim dt As DataTable=DataTables("用户表")
Dim dr As DataRow
If user="" Then
MessageBox.show("请输入用户名称!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
Return
Else
dr=dt.find("用户名称='" & user & "'")
If dr IsNot Nothing Then
If pows=dr("密码") Then
PopMessage("登陆成功","提示",PopIconEnum.Infomation,1)
If QQClient.Ready Then
MessageBox.show("QQClient已经启动,请先关闭","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
QQClient.ServerIP = "127.0.0.1" '指定服务器IP地址
QQClient.ServerPort = 52177 '指定服务器端口
QQClient.UserName = e.Form.Controls("ComboBox1").Value '指定登录用户名
QQClient.Password = e.Form.Controls("TextBox2").Value
If QQClient.Start() = True '如果登录成功
e.Form.Controls("btnChat").Enabled = True
Dim msg As String = "恭喜,OpenQQ登录成功!"
If QQClient.ServerMessage > "" Then '如果服务器返回了欢迎信息
msg = msg & QQClient.ServerMessage
End If
popMessage(msg,"提示",PopiconEnum.Infomation,5)
Else '如果登录失败,显示服务器返回错误信息
e.Form.Controls("btnChat").Enabled = False
PopMessage("QQClient登录失败,原因:" & vbcrlf & QQClient.ServerMessage,"提示",PopiconEnum.Error,5)
End If
dr("登陆时间")=Date.Now
dr("登陆账套")=sss
dr.Save()
usna=user
syscmd.project.open(ProjectFile,sss)
e.Form.close
'syscmd.project.Exit(True)
Return
Else
MessageBox.show("密码错误","提示")
Return
End If
Else
MessageBox.show("用户不存在!","提示")
Return
End If
End If