# 好多问题ㄛ......

Posted by 猪头 on August 05, 1999 at 21:15:46:

请问 如果要比对其中第3个栏位 (5个栏位明名称各不同) 应如何分别
又 如果"aa"是个变数(由Textbox 或由Label 来决定) 这样写对吗----
Val(x)= Text1.text 或 Val(x)=label1.label
If rec.TR(J) = x
这样可以吗 错在那里?

Option Explicit
Private Type Score
TR(1 To 5) As String * 2'/*共10个位元组*/
End Type
Dim rec As Score, I As Byte, J As Byte, s As Long

Private Sub Command1_Click()
Open "c:\WW.TXT" For Random As #1 Len = 10'/*每笔资料10个位元组*/
For I = 1 To 100'/*到100笔资料*/
Get #1, I, rec
For J = 1 To 5'/*共5个栏位*/
If rec.TR(J) = "AA" Then s = s + 1
Next
Next
Close #1

Me.Caption = s
End Sub

Follow Ups: