CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Posts
    2

    error handling in vb.net

    I am trying to capture errors specific to the floppy drive. I want to capture the error number for floppy not in drive, disk write protected and file not found, any help appreciated Thanks

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878
    Here is how to check if floppy is in

    Imports System.IO
    Public Class Form1
    Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "
    #End Region
    Dim Retries As Short = 0

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Try
    PictureBox1.Image = System.Drawing.Bitmap.FromFile("a:\fileopen.bmp")
    Catch
    Retries += 1
    If Retries <= 2 Then
    MsgBox("Please insert the disk in drive A!")
    Else
    MsgBox("File Load feature disabled")
    Button1.Enabled = False
    End If
    End Try

    End Sub
    End Class
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured