Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532515
  • 博文数量: 119
  • 博客积分: 3167
  • 博客等级: 中校
  • 技术积分: 1215
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-20 21:21
文章分类

全部博文(119)

文章存档

2015年(21)

2012年(4)

2011年(1)

2007年(11)

2006年(50)

2005年(32)

分类:

2006-01-11 02:24:47


Dim str As String
Private Sub Command1_Click()
On Error GoTo err
    cdc.DialogTitle = "选择你要打开的文件"
    cdc.InitDir = "c:\"
    cdc.Filter = "*.txt|*.txt"
    cdc.ShowOpen
    Open cdc.FileName For Input As #1
    If LOF(1) > 0 Then
      Text1.Text = ""
     While Not EOF(1)
      x = DoEvents
      Line Input #1, str
      Text1.Text = Text1.Text + str + vbCrLf
'     Debug.Print str
     Wend
    End If
    Close #1
    Exit Sub
err:
    MsgBox "open file error"
    Unload Form1
End Sub

Private Sub Command2_Click()
On Error GoTo err
    cdc.DialogTitle = "选择你要保存的文件"
    cdc.InitDir = "c:\"
    cdc.Filter = "*.txt|*.txt"
    cdc.ShowSave
    Open cdc.FileName For Output As #2
    Print #2, Text1.Text
    Close #2
    Exit Sub
err:
    MsgBox "open file error"
    Unload Form1
End Sub

阅读(12665) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~