Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:25:38+00:00 2026-06-12T20:25:38+00:00

Dim Permission As String Dim chk As String = p Permission = (ds.Tables(privilege).Rows(0).Item(0)).ToString MessageBox.Show(Permission)

  • 0
Dim Permission As String
        Dim chk As String = "p"
        Permission = (ds.Tables("privilege").Rows(0).Item(0)).ToString
        MessageBox.Show(Permission)
        Dim PermissionArray() As String = Split(Permission, ":")
        For i As Integer = 0 To 36
            If PermissionArray(i) = 1 Then
                Try
                    Dim chkBox As CheckBox = CType(Me.Controls(chk & i), CheckBox)
                    chkBox.Checked = True
                Catch ex As Exception
                    MessageBox.Show(ex.ToString)
                End Try
            End If
        Next

This code gives me the following error in catch, i have googled but nothing is working

This is the error: System.NullReferenceException – Object reference not set to an instance of an object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:25:39+00:00Added an answer on June 12, 2026 at 8:25 pm

    As you noted chkBox.Checked throws NullReferenceException, you should evaluate the following line for the error:

    Dim chkBox As CheckBox = CType(Me.Controls(chk & i), CheckBox)
    
    ' This may throw NullReferenceException if there is no (chk & i) control available
    chkBox.Checked = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

dim dataType as String toolTip=Marks And Number[String] I want to get the [String] alone.
Dim insert_coupon_query As String = (INSERT INTO qa_discountcoupons (id, status_code) VALUES (AUTO_INCREMENT_ID, 5)) Dim
Dim i as integer For i = 0 to 365 sqlinsert.InsertCommand=insert into cashdate (date)
Dim CustID As String = txtSrchCustID.Text Dim FirstName As String = txtNewCustFName.Text Dim SecondName
Dim n, front, rear As Integer Dim x As Integer Dim arr() As Integer
Dim MaxItemID As Integer Dim objCMD As New SqlCommand(StrSql, objConn) MaxItemID = IIf(IsDBNull(objCMD.ExecuteScalar()), 0,
Dim goodCustObjList As New List(Of CustomerObj) goodCustObjList = DataBLLModule.GetCustomerRecordList(String.Empty) Dim custList = From t
Dim sql As String = Select ProductID From OrderDetail Order By ProductID Desc Dim
Dim MyInsert As String = INSERT INTO Inventory(userid, Type,Number) Values( & _ txtEquipCat.text &
Dim dtmStart As Date, dtmEnd As Date, dblDuration As Double dtmStart = 1900/01/01 08:10:00

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.