| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 642 人关注过本帖
标题:[求助]不知道为什么这样?
只看楼主 加入收藏
六个石头
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-3-26
收藏
 问题点数:0 回复次数:3 
[求助]不知道为什么这样?


Sub ReadFile()
Dim SR As StreamReader
OpenFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
mFileName = OpenFileDialog1.FileName
SR = New streamreader(mFileName, System.Text.Encoding.Default)
TextBox1.Text = SR.readtoend
SR.Close()

End If
End Sub
这是个编写读文件处理的过程。但是不知道为什么说“StreamReader” 未定义类型!高手帮我看下

[此贴子已经被作者于2006-5-14 8:55:15编辑过]

搜索更多相关主题的帖子: 文本文件 
2006-05-14 08:45
wugong
Rank: 1
等 级:新手上路
帖 子:69
专家分:0
注 册:2005-8-1
收藏
得分:0 

Sub ReadFile()
Dim SR As System.IO.StreamReader ‘修改此处
OpenFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
mFileName = OpenFileDialog1.FileName
SR = New streamreader(mFileName, System.Text.Encoding.Default)
TextBox1.Text = SR.readtoend
SR.Close()

End If
End Sub

2006-05-14 09:21
六个石头
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-3-26
收藏
得分:0 
谢谢~ 可以帮忙分析一下,为什么要那样修改?
2006-05-14 09:44
六个石头
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-3-26
收藏
得分:0 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MusicDir As String
Dim Fileindex As Integer
Dim PlayPos As Integer
If File.Exists(Application.StartupPath & "\Info.txt") Then
Dim fs As New StreamReader(Application.StartupPath & "\Info.txt")
MusicDir = fs.ReadLine
Fileindex = Convert.ToInt32(fs.ReadLine)
PlayPos = Convert.ToInt32(fs.ReadLine)
fs.Close()
DriveListBox1.Drive = Path.GetPathRoot(MusicDir)
DirListBox1.Path = MusicDir
FileListBox1.SelectedIndex = Fileindex
'播放
Play(PlayPos)
btnPlay.Text = "暂停"
Else
btnPlay.Text = "播放"
End If
End Sub
只是播放器里面的一段代码,看有错没?什么提示都没?就是运行不出“未处理的“System.ArgumentOutOfRangeException”类型的异常出现在 system.windows.forms.dll 中

其他信息:指定的参数已超出有效值的范围。”

2006-05-14 16:10
快速回复:[求助]不知道为什么这样?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016897 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved