首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

打开文件的有关问题

2012-02-09 
打开文件的问题我写了一个能打开文件,并将其读入列表框的函数。但是调试时总提示文件已打开,请问怎么回事?P

打开文件的问题
我写了一个能打开文件,并将其读入列表框的函数。但是调试时总提示文件已打开,请问怎么回事?

  Private Function open(ByVal jl As String) As Integer
  If Dir(Application.StartupPath & "\" & jl & ".txt") <> "" Then
  FileOpen(1, Application.StartupPath & "\" & jl & ".txt", OpenMode.Input, OpenAccess.Read, OpenShare.Default)
  Dim mLine As String
  Do While Not EOF(1)
  mLine = LineInput(1)
  ListBox1.Items.Add(mLine)
  Loop
  FileClose(1)
  Return 0
  Else
  showmsg("该记录不存在")
  End If
  End Function

[解决办法]
提供一个尚未使用的文件号

热点排行