(OpenFileDialog问题) [英] (OpenFileDialog problem)

查看:95
本文介绍了(OpenFileDialog问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我的代码有问题.我制作了一个程序和一个按钮,用于打开所有文件和大多数.ISO文件!问题是,当我打开txt文件时,已经显示的文本框会显示该文本框,但是当我打开ISO文件时,程序崩溃了,请问 看到它并正确粘贴我的代码??我也需要打开.iso文件!

Hello i have a problem with my code. I made a programme and one button that opens All files and most .ISO files! The problem is that when i opening txt files the textbox that i have shows it but when iam opening ISO files the programme crashed, can you please see it and paste me the code correctly?? I need to open .iso files too!!!

将OpenDLG变暗为新的OpenFileDialog

       OpenDLG.Filter =所有文件(*.*)| *.*"
       OpenDLG.Title =打开文件"
       OpenDLG.InitialDirectory ="C:\"
       OpenDLG.RestoreDirectory = True

       DialogResult = OpenDLG.ShowDialog

      如果DialogResult = Windows.Forms.DialogResult.OK然后

           昏暗的objreader作为新的System.IO.StreamReader(OpenDLG.FileName)

            TextBox1.Text = objreader.ReadToEnd

            objreader.Close()

            Me.Text =所有文件(*.*)| " + OpenDLG.FileName
            Label1.Text = OpenDLG.FileName.ToString()

      否则,如果DialogResult = Windows.Forms.DialogResult.Cancel然后

      如果结束
结束

  Dim OpenDLG As New OpenFileDialog

        OpenDLG.Filter = "All Files(*.*)|*.*"
        OpenDLG.Title = "Open File"
        OpenDLG.InitialDirectory = "C:\"
        OpenDLG.RestoreDirectory = True

        DialogResult = OpenDLG.ShowDialog

        If DialogResult = Windows.Forms.DialogResult.OK Then

            Dim objreader As New System.IO.StreamReader(OpenDLG.FileName)

            TextBox1.Text = objreader.ReadToEnd

            objreader.Close()

            Me.Text = "All Files(*.*)| " + OpenDLG.FileName
            Label1.Text = OpenDLG.FileName.ToString()

        Else If DialogResult = Windows.Forms.DialogResult.Cancel Then

        End If
    End Sub

推荐答案

这并不像Small Basic编程语言那样令人毛骨悚然,也许您应该尝试其他论坛.
This doesn't lool like a problem about the Small Basic programming language, perhaps you should try another forum.


这篇关于(OpenFileDialog问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆