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 6995631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:03:16+00:00 2026-05-27T20:03:16+00:00

Ok, I got a tickler for your brains. I am converting a program I

  • 0

Ok, I got a tickler for your brains. I am converting a program I wrote in VB6 to Visual Studio 2010 VB.Net and have run into a problem. I am trying to cycle through 20 form elements on a form that all have the prefix ‘chkCustomerItems’ and then have a number 1 to 20 behind them. I am using this with a database lookup so that it there is a database entry it then applies the database item name to the checkbox’s text field and turns visibility on. Here is the code I wrote:
ConnOpenClose()

Rs = New ADODB.Recordset
Sql = "SELECT * FROM CustomersItems;"
Rs.Open(Sql, Conn)

If Rs.EOF = False Then
    tempInteger = 1
    Rs.MoveFirst()
    Do
        tempString = "chkCustomerItems" & tempInteger.ToString
        Me.Controls(tempString).Text = Rs.Fields("Item").Value
        Me.Controls(tempString).Visible = True
        tempInteger = tempInteger + 1
        Rs.MoveNext()
        If tempInteger = 21 Then GoTo ExitLoop
    Loop Until Rs.EOF
ExitLoop:
End If

When it runs, I get a NullReferenceException error. This is basically the code that I used in VB6 (with some changes for .NET infrastructure). Help me please figure out what I am doing wrong, for the time being I am having to hard code all 20 items in, and while it works, it doesn’t look nor run pretty.

Thank you in advance

  • 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-05-27T20:03:16+00:00Added an answer on May 27, 2026 at 8:03 pm

    you are using Text property so i assume that this is textbox.
    try this:

    DirectCast(Controls(tempString), TextBox).Text = Rs.Fields("Item").Value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
Got a bit of a mind freeze at the moment. I have the following
Got a Grails 2 app and executing run-app works fine, run-war fails: 2011-12-24 12:43:40,996
Got a problem here on exiting onclick. The program uses shared preferences to get
Got a task to make a program that registers animals and the object is
Ok I kinda got stucked on the basics.I have a method in class that
Got a situation where we have a working production website that is moving to
got a bit of a problem with Zend not adding the base url into
Got Phonegap working, but not seeing the staticmap.png image for your current location <div

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.