Anyone knows what does it says?
An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in GAC_System.Windows.Forms_v1_0_3300_0_cneutral_1.dll
Printable View
Anyone knows what does it says?
An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in GAC_System.Windows.Forms_v1_0_3300_0_cneutral_1.dll
What exactly does your code look like. Just from scanning over the thrown exception indicates a directory that does not exist was trying to get accessed.
My code...
VB Code:
Imports System.Object Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) MyBase.Dispose(disposing) End Sub 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents tbmain As System.Windows.Forms.TextBox Private Sub InitializeComponent() Me.MainMenu1 = New System.Windows.Forms.MainMenu() Me.tbmain = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() ' 'tbmain ' Me.tbmain.Location = New System.Drawing.Point(24, 32) Me.tbmain.Multiline = True Me.tbmain.Size = New System.Drawing.Size(192, 128) Me.tbmain.Text = "TextBox1" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(112, 200) Me.Button1.Size = New System.Drawing.Size(104, 40) Me.Button1.Text = "Button1" ' 'Form1 ' Me.ClientSize = New System.Drawing.Size(240, 270) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.tbmain) Me.Menu = Me.MainMenu1 Me.Text = "Form1" End Sub Public Shared Sub Main() Application.Run(New Form1()) Directory.CreateDirectory("D:\Louis\Misc\listing.txt") End Sub #End Region Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sIn As StreamReader Dim cLine As String Dim bDone As Boolean = False Dim din As StreamReader = File.OpenText("D:\Louis\misc\listing.txt") Try While Not bDone cLine = sIn.ReadLine() If cLine Is Nothing Then bDone = True Else tbmain.Text = tbmain.Text & cLine End If End While Finally sIn.Close() End Try End Sub End Class
Try this and see what you come up with...
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sIn As StreamReader Dim cLine As String Dim bDone As Boolean = False Try Dim din As StreamReader = File.OpenText("D:\Louis\misc\listing.txt") Catch ex As Exception MessageBox.Show(ex.toString) End Try Try While Not bDone cLine = sIn.ReadLine() If cLine Is Nothing Then bDone = True Else tbmain.Text = tbmain.Text & cLine End If End While Finally sIn.Close() End Try End Sub
I run this on the PocketPC Emulator but the message box shows " System.IO.DirectoryNotFoundException"
I think it somehow still can't find a route to my D:/ ?