Advertisement

06.06.2007 at 03:58AM PDT, ID: 22615944
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll

Asked by supersuny2k in Microsoft Visual Basic.Net

Tags: , ,

Hi,

I am using the following code to open a new form...

There is an Opendialogue box that opens a file.. a sub reads the file and if an error is detected it opens a new form.

If I click on a save function on the new form the app crashed with the above error or if I close it normally and then click on the Open button on the main form again it causes the same error. Any Ideas?

Many Thanks,

Josh

Code:
Private Sub cmdOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOpen.Click
        Dim Item As String
        Dim diag As New OpenFileDialog
        Try
            diag.Filter = "All files (*.*)|*.*|Comman Seperate Vaules (*.csv)|*.csv|Text Files (*.txt)|*.txt"
            diag.FilterIndex = 2
            diag.Multiselect = True
            diag.ShowDialog()
            For Each Item In diag.FileNames
                If InStr(Item.ToLower, ".csv") > 0 Then
                    AddCSV(Item)
                ElseIf InStr(Item.ToLower, ".txt") > 0 Then
                    AddTxt(Item)
                End If
            Next
            diag.Dispose()
            diag = Nothing
        Catch ex As Exception
            MsgBox("Error!!!: " & ex.ToString, MsgBoxStyle.Critical, "Error")
        End Try
        SetCountLabel(lblCountImport, lstUsers, False)
    End Sub

    Function AddCSV(ByVal Item As String) As Boolean
        Dim arrFile() As String
        Dim FileReader As StreamReader
        Dim Readline As String = String.Empty
        Dim arrReadline() As String
        Dim oLocation As New Locations
        Dim UserLocation As String
        Dim GroupLocation As String
        Dim ErrorArraylist As New ArrayList
        Dim ErrLocation As Boolean = False
        Dim Results As String
        Dim i As Integer
        Try
            arrFile = Item.Split(CChar("\"))
            If sLogFilename.Length = 0 Then
                sLogFilename = arrFile(UBound(arrFile))
            Else
                sLogFilename = sLogFilename & " - " & arrFile(UBound(arrFile))
            End If
            sLogFilename = sLogFilename.Replace(".csv", "")
            FileReader = New StreamReader(Item)
            Do
                Readline = FileReader.ReadLine
                If Not (Readline Is Nothing) Then
                    lstUsers.Items.Add(Readline)
                    arrReadline = Readline.ToUpper.Split(CChar(","))
                    UserLocation = oLocation.SetUserLocation(arrReadline(0))
                    GroupLocation = oLocation.SetUserLocation(arrReadline(1))
                    If UserLocation <> GroupLocation Then
                        ErrLocation = True
                        ErrorArraylist.Add(Readline)
                    End If
                End If
            Loop Until (Readline Is Nothing)
            If Not (FileReader Is Nothing) Then
                FileReader.Close()
            End If
            If ErrLocation Then
                Dim fError As New _Error
                fError.Show()
            End If
        Catch ex As Exception
            CreateDebugLog("OpenDialog" & vbCrLf & ex.ToString & vbCrLf & "----------------------------" & vbCrLf)
        End Try
    End FunctionStart Free Trial
[+][-]06.06.2007 at 04:04AM PDT, ID: 19224032

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2007 at 04:30AM PDT, ID: 19224135

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2007 at 05:06AM PDT, ID: 19224289

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2007 at 05:47AM PDT, ID: 19224565

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2007 at 05:48AM PDT, ID: 19224574

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2007 at 08:18AM PDT, ID: 19225832

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: unhandled, exception, type
Sign Up Now!
Solution Provided By: cheddar73
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.06.2007 at 09:11AM PDT, ID: 19226270

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44