none
VB .NET NullReference Exception was Unhandled RRS feed

  • Question

  • Imports

    System.IO

    Public

    Class Form1

    Dim fname1, fname2 As String

    Private Sub Browse1_Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Browse1_Btn.Click

    Try

    TextBox1.Text =

    ""

    OpenFileDialog1.FileName =

    "Open a XML file..."

    OpenFileDialog1.Filter =

    "XML Files (*.xml)|*.xml"

    OpenFileDialog1.ShowDialog()

    Catch ex As Exception

    MsgBox(ex.ToString())

    End Try

    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk

    Try

    OpenFileDialog1.OpenFile()

    TextBox1.Text = OpenFileDialog1.FileName.ToString()

    fname1 = OpenFileDialog1.FileName.ToString()

    Catch ex As Exception

    MsgBox(ex.ToString())

    End Try

    End Sub

    Private Sub OpenFileDialog2_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog2.FileOk

    Try

    OpenFileDialog2.OpenFile()

    If fname1 = OpenFileDialog2.FileName.ToString() Then

    MsgBox(

    "Select Two Different Files")

    TextBox2.Text =

    ""

    OpenFileDialog2.FileName =

    "Open a XML file..."

    OpenFileDialog2.Filter =

    "XML Files (*.xml)|*.xml"

    OpenFileDialog2.ShowDialog()

    End If

    TextBox2.Text = OpenFileDialog2.FileName.ToString()

    fname2 = OpenFileDialog2.FileName.ToString()

    Catch ex As Exception

    MsgBox(ex.ToString())

    End Try

    End Sub

    Private Sub Browse2_Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Browse2_Btn.Click

    Try

    TextBox2.Text =

    ""

    OpenFileDialog2.FileName =

    "Open a XML file..."

    OpenFileDialog2.Filter =

    "XML Files (*.xml)|*.xml"

    OpenFileDialog2.ShowDialog()

    Catch ex As Exception

    MsgBox(ex.ToString())

    End Try

    End Sub

    End

    Class

    Saturday, March 3, 2012 11:45 AM

Answers

  • Hi Allen Li,

    Thank you four response..

    Today that the program works normally(Same Coding)..

    Thanks and Regards,

    Sakthi.Singaravel

    Developer

    SPi-Global

    (a subsidiary of PLDT)

    Monday, March 5, 2012 11:59 AM

All replies

  • Hi Sakthi.Singaravel,

    Welcome to MSDN Forum.

    Could you please point which line throws the exception?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 5, 2012 3:35 AM
    Moderator
  • Hi Allen Li,

    Thank you four response..

    Today that the program works normally(Same Coding)..

    Thanks and Regards,

    Sakthi.Singaravel

    Developer

    SPi-Global

    (a subsidiary of PLDT)

    Monday, March 5, 2012 11:59 AM