逐行解释:A>>
Private Type palinfo
past As String * 10
End Type
Dim pal As palinfo
Private Sub Command1_Click()
Open "c:\in6.txt" For Random As #1 Len = Len(pal)
s = 0
For e = 0 To 11
If Check1(e).Value = 1 And s <= 11 Then
pal.past = Check1(e).Caption
s = s + 1
Put #1, s, pal
End If
Next e
Close #1
MsgBox "提交成功"
Command1.Enabled = False
End Sub
B>>:
Private Type palinfo
past As String * 10
End Type
Dim pal As palinfo
Private Sub Command1_Click()
Form3.Show
End Sub
Private Sub Form_Load()
Open "c:\in5.txt" For Random As #1 Len = Len(pal)
t = 1
Do While Not EOF(1)
Get #1, t, pal
Text1.Text = Text1.Text & vbCrLf & pal.past
t = t + 1
Loop
Close #1
Open "c:\in6.txt" For Random As #1 Len = Len(pal)
e = 1
Do While Not EOF(1)
Get #1, e, pal
Text2.Text = Text2.Text & vbCrLf & pal.past
e = e + 1
Loop
Close #1
End Sub
Option Explicit
Private Type palinfo '用户自定义的数据类型palinfo
past As String * 10 '字符型,长度为10
End Type
Dim pal As palinfo '定义pal 为palinfo类型
Private Sub Command1_Click()
Open "c:\in6.txt" For Random As #1 Len = Len(pal) '随机访问方式打开文件,长度为10
s = 0
For e = 0 To 11
If Check1(e).Value = 1 And s <= 11 Then '判断控件数组check(0-11)中的值为1且s<=11
pal.past = Check1(e).Caption '赋值
s = s + 1
Put #1, s, pal '按指定的记录号把pal写入文件
End If
Next e
Close #1 '关闭文件
MsgBox "提交成功" '提示框显示
Command1.Enabled = False
End Sub
'B>>:
Private Type palinfo '参考开始的说明
past As String * 10
End Type
Dim pal As palinfo
Private Sub Command1_Click()
Form3.Show 'form3窗体显示
End Sub
Private Sub Form_Load()
Open "c:\in5.txt" For Random As #1 Len = Len(pal) '参考上面说明
t = 1
Do While Not EOF(1) '循环,直到文件结束
Get #1, t, pal '根据指定记录号从文件中读出到pal
Text1.Text = Text1.Text & vbCrLf & pal.past '吧pal添加到text1中
t = t + 1
Loop
Close #1 '关闭文件
Open "c:\in6.txt" For Random As #1 Len = Len(pal) '参考前面说明
e = 1
Do While Not EOF(1)
Get #1, e, pal
Text2.Text = Text2.Text & vbCrLf & pal.past
e = e + 1
Loop
Close #1
End Sub
这些都是VB最基本的操作啊。不知道楼主怎么学的。无语了。
除非你没有学过VB。