Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "登录失败"
Text2.Text = ""
Else
Open "d:\a.txt" For Append As #1
Input #1, a, b
If Text1.Text = a And Text2.Text = b Then
MsgBox "登陆成功"
Text1.Text = ""
Text2.Text = ""
Else
MsgBox "登录失败"
End If
Close #1
End If
End Sub
Private Sub Command2_Click()
Me.Hide
Form2.Show
End Sub
Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "注册失败"
Text1.Text = ""
Text2.Text = ""
Else
MsgBox "注册成功"
Open "D:\a.txt" For Append As #1
Write #1, Text1.Text, Text2.Text
Close #1
Text1.Text = ""
Text2.Text = ""
Me.Hide
Form1.Show
End If
End Sub
是这两段有问题,还是根本不能用文件来解决?
Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "登录失败"
Text2.Text = ""
Else
Open "d:\a.txt" For input As #1
Input #1, a, b
If Text1.Text = a And Text2.Text = b Then
MsgBox "登陆成功"
Text1.Text = ""
Text2.Text = ""
Else
MsgBox "登录失败"
End If
Close #1
End If
End Sub
Private Sub Command2_Click()
Me.Hide
load form2
Form2.Show
End Sub
Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "注册失败"
Text1.Text = ""
Text2.Text = ""
Else
MsgBox "注册成功"
Open "D:\a.txt" For Append As #1
Write #1, Text1.Text, Text2.Text
Close #1
Text1.Text = ""
Text2.Text = ""
Me.Hide
load form1
Form1.Show
End If
End Sub
代码已经帮你修改好了,在VB中进行文件操作的时候:
open filepath for input|output|append|binary|random as freefile()
‘其中用于输出写文件的有output,append,binary,random,用于输入读文件的有input,binary,random
input|line input|print|write|put|get filenumber, 变量列表
‘input,line input,get用于输入读文件操作
’print,write,put用于输出写文件操作
close
在进行窗体的切换操作的时候,显示一个窗体,需要先对窗体进行加载操作,然后再进行显示
load form_name
form_name.show
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息