文件mm.dat里有字段:日期,姓名,工资,奖金
小妹想删除工资,奖金字段,请教该如何做:
以下是打开mm.dat文件的代码:
Option Explicit
Private Type Record ' 定义用户自定义数据类型。
mDate As String * 10
  Name As String * 20
  Gongzi As Single
  Jiangjin As Single
End Type
Private Sub Command1_Click()
Dim MeRecord As Record
Dim i As Integer
  Open App.Path & "\mm.dat" For Binary As #1
  With MSFlexGrid1
   .Rows = 1
   .Cols = 4
   .TextMatrix(0, 0) = "姓名"
   .TextMatrix(0, 1) = "日期"
   .TextMatrix(0, 2) = "工资"
   .TextMatrix(0, 3) = "奖金"
   For i = 1 To LOF(1) \ Len(MeRecord)
    Get #1, , MeRecord
    .Rows = .Rows + 1
    .TextMatrix(.Rows - 1, 0) = MeRecord.mDate
    .TextMatrix(.Rows - 1, 1) = MeRecord.Name
    .TextMatrix(.Rows - 1, 2) = MeRecord.Gongzi
    .TextMatrix(.Rows - 1, 3) = MeRecord.Jiangjin
   Next i
  End With
 Close #1
End Sub
Private Sub Command2_Click()
'请帮助写一段删除字段工资和奖金的代码,谢谢!!!
End Sub
arrow
arrow
    全站熱搜

    vbqa 發表在 痞客邦 留言(1) 人氣()