troubleshooting Question

Help with setting values to x, y when clicking on checkbox of combobox

Avatar of vcharles
vcharles asked on
.NET ProgrammingASP.NETVisual Basic.NET
17 Comments1 Solution419 ViewsLast Modified:

I am using the code below to set values to x an y variables depending on which
checkbox I select, but I'm getting the following error:

Object reference not set to an instance of an object.

on line: Dim val As String = chkSelect.Text


Protected Sub Button135_Click(sender As Object, e As EventArgs) Handles Button135.Click
        Dim str1 As String = Nothing
        Dim x, y As Integer
        Dim ctrl As Control = MultiView1.FindControl("C1SDeactivation")
        For i = 0 To C1SDeactivationA.Items.Count - 1
            Dim chkSelect As CheckBox = CType(ctrl.FindControl(i), CheckBox)
            Dim val As String = chkSelect.Text
            If str1 = "De-Arming" Then
                x = 1
                x = 0
            End If
            If str1 = "Sterilized" Then
                y = 1
                y = 0
            End If
    End Sub

How do I fix this problem?


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros