[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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.0

Object Reference fault

Asked by steensommer in Microsoft Visual Basic.Net

Tags: refer

Hi

Visual Basic .net (express edition) windows application.

Sometime when running the following code I get this message:

"Object reference not set to an instance of an object"

The fault is probably somewhere in the start because when it runs smoothly the Messagebox is displayed but not when the fault appears.

The Code:
        Dim sPath As String = "\\server\faelles\Index Data\Patientmapper\"
        With CheckList1
            .Add(TextBox1)
            .Add(TextBox2)
            .Add(TextBox4)
            .Add(TextBox3)
            .Add(TextBox9)
            .Add(TextBox12)
            .Add(TextBox21)
            .Add(TextBox29)
            .Add(TextBox25)
            .Add(TextBox26)
            .Add(TextBox33)
            .Add(TextBox31)
            .Add(TextBox39)
            .Add(TextBox37)
            .Add(TextBox45)
            .Add(TextBox53)
            .Add(TextBox49)
            .Add(TextBox50)
            .Add(TextBox57)
            .Add(TextBox55)
            .Add(TextBox63)
            .Add(TextBox71)
            .Add(TextBox67)
            .Add(TextBox68)
        End With

        If xlApp.Workbooks.Count > 0 Then
            MessageBox.Show("Kun patientlisten må være åben!")

        Else

            Try

                Dim Msg As String, Style As String, Title As String, Response As String
                Msg = "Skal alle medicinlister udprintes?"    ' Define message.
                Style = vbYesNo + vbDefaultButton2     ' Define buttons.
                Title = "Meddelelsesbox"    ' Define title.
                Response = MsgBox(Msg, Style, Title)
                If Response = vbYes Then

                    SuspendLayout()
                    Dim Dag As String
                    Dim i As Integer
                    For i = 0 To CheckList1.Count - 1
                        Dim tb2 As TextBox = CType(CheckList1(i), TextBox)

                        If tb2.Text = TextBox1.Text Then
                            Cpr = TextBox73.Text
                            Dag = TextBox118.Text
                        ElseIf tb2.Text = TextBox2.Text Then
                            Cpr = TextBox74.Text
                            Dag = TextBox119.Text
                        ElseIf tb2.Text = TextBox4.Text Then
                            Cpr = TextBox76.Text
                            Dag = TextBox121.Text
                        ElseIf tb2.Text = TextBox3.Text Then
                            Cpr = TextBox75.Text
                            Dag = TextBox120.Text
                        ElseIf tb2.Text = TextBox9.Text Then
                            Cpr = TextBox95.Text
                            Dag = TextBox117.Text
                        ElseIf tb2.Text = TextBox12.Text Then
                            Cpr = TextBox96.Text
                            Dag = TextBox116.Text
                        ElseIf tb2.Text = TextBox21.Text Then
                            Cpr = TextBox77.Text
                            Dag = TextBox112.Text
                        ElseIf tb2.Text = TextBox29.Text Then
                            Cpr = TextBox78.Text
                            Dag = TextBox113.Text
                        ElseIf tb2.Text = TextBox25.Text Then
                            Cpr = TextBox80.Text
                            Dag = TextBox115.Text
                        ElseIf tb2.Text = TextBox26.Text Then
                            Cpr = TextBox79.Text
                            Dag = TextBox114.Text
                        ElseIf tb2.Text = TextBox33.Text Then
                            Cpr = TextBox94.Text
                            Dag = TextBox111.Text
                        ElseIf tb2.Text = TextBox31.Text Then
                            Cpr = TextBox97.Text
                            Dag = TextBox110.Text
                        ElseIf tb2.Text = TextBox39.Text Then
                            Cpr = TextBox92.Text
                            Dag = TextBox109.Text
                        ElseIf tb2.Text = TextBox37.Text Then
                            Cpr = TextBox91.Text
                            Dag = TextBox108.Text
                        ElseIf tb2.Text = TextBox45.Text Then
                            Cpr = TextBox81.Text
                            Dag = TextBox104.Text
                        ElseIf tb2.Text = TextBox53.Text Then
                            Cpr = TextBox82.Text
                            Dag = TextBox105.Text
                        ElseIf tb2.Text = TextBox49.Text Then
                            Cpr = TextBox84.Text
                            Dag = TextBox107.Text
                        ElseIf tb2.Text = TextBox50.Text Then
                            Cpr = TextBox83.Text
                            Dag = TextBox106.Text
                        ElseIf tb2.Text = TextBox57.Text Then
                            Cpr = TextBox90.Text
                            Dag = TextBox103.Text
                        ElseIf tb2.Text = TextBox55.Text Then
                            Cpr = TextBox89.Text
                            Dag = TextBox102.Text
                        ElseIf tb2.Text = TextBox63.Text Then
                            Cpr = TextBox85.Text
                            Dag = TextBox99.Text
                        ElseIf tb2.Text = TextBox71.Text Then
                            Cpr = TextBox86.Text
                            Dag = TextBox98.Text
                        ElseIf tb2.Text = TextBox67.Text Then
                            Cpr = TextBox88.Text
                            Dag = TextBox101.Text
                        Else
                            Cpr = TextBox87.Text
                            Dag = TextBox100.Text
                        End If

                        If tb2.Text <> "" And Microsoft.VisualBasic.Left(i, 1) <> "R" And Microsoft.VisualBasic.Left(i, 1) <> "P" And Dag > "-1" Then
                            xlApp.Workbooks.Open(sPath & Cpr & ".opr")
                            With xlApp.ActiveWorkbook
                                .Sheets("Medicin").Activate()
                                .ActiveSheet.PrintOut(Copies:=1, Collate:=True)
                                .Close(False)
                            End With
                        ElseIf tb2.Text <> "" And Microsoft.VisualBasic.Left(i, 1) <> "R" And Microsoft.VisualBasic.Left(i, 1) <> "P" And Dag = "-1" Then
                            xlApp.Workbooks.Open(sPath & Cpr & ".opr")
                            With xlApp.ActiveWorkbook
                                .Sheets("Stamkort").Activate()
                                .ActiveSheet.PrintOut(Copies:=1, Collate:=True)
                                .Close(False)
                            End With
                        End If

                    Next i
                    ResumeLayout()
                End If

            Catch oexpData As OleDb.OleDbException
                MsgBox(oexpData.Message)
            End Try

        End If


[+][-]07/03/06 12:19 PM, ID: 17033088Expert Comment

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.

 
[+][-]07/03/06 01:00 PM, ID: 17033305Author Comment

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.

 
[+][-]07/03/06 08:00 PM, ID: 17034692Accepted Solution

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: refer
Sign Up Now!
Solution Provided By: bruintje
Participating Experts: 1
Solution Grade: A
 
[+][-]07/03/06 10:41 PM, ID: 17035100Author Comment

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.

 
[+][-]07/04/06 04:06 AM, ID: 17036239Author Comment

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.

 
[+][-]07/04/06 04:36 AM, ID: 17036393Expert Comment

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.

 
[+][-]07/04/06 06:35 AM, ID: 17036860Author Comment

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.

 
[+][-]07/04/06 07:37 AM, ID: 17037145Expert Comment

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.

 
[+][-]07/04/06 08:22 AM, ID: 17037395Author Comment

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.

 
[+][-]07/04/06 08:26 AM, ID: 17037416Expert Comment

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.

 
[+][-]07/04/06 09:35 AM, ID: 17037778Author Comment

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.

 
[+][-]07/04/06 10:03 AM, ID: 17037909Expert Comment

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.

 
[+][-]07/04/06 10:04 AM, ID: 17037915Expert Comment

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.

 
[+][-]07/04/06 10:07 AM, ID: 17037938Author Comment

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.

 
[+][-]07/04/06 10:10 AM, ID: 17037956Expert Comment

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.

 
[+][-]07/04/06 10:10 AM, ID: 17037959Expert Comment

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.

 
[+][-]07/04/06 10:28 AM, ID: 17038030Author Comment

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.

 
[+][-]07/04/06 10:34 AM, ID: 17038061Expert Comment

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.

 
[+][-]07/04/06 11:12 AM, ID: 17038231Author Comment

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.

 
[+][-]07/04/06 11:15 AM, ID: 17038239Expert Comment

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.

 
 
Loading Advertisement...
20091111-EE-VQP-89