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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:11:04+00:00 2026-05-18T02:11:04+00:00

I have a form which has a search feature – a single text field

  • 0

I have a form which has a search feature – a single text field and command button; when the text field is filled-in a database query is executed and the result (if one result returned) is shown on the form via dynamic control fields.

When the search feature is used for the first time, the fields are created and the data is returned from the database, however when the search feature is re-ran I am getting the error “Object Reference not set to an instance of an object”, the error occurs at:

initSearch(txtSearchInput.Text)

I am guessing that I am not handling the textfield properly for this type of use, can anyone please advise how else I should be doing this?

The txtSearchInput is not a dynamic field, it has been created through the design mode, the same for the command button. The above code is located in the command button On Click event:

 Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
        Try
            initSearch(txtSearchInput.Text)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Error Encountered")
        End Try


    End Sub

Any help would be greatly appreciated.

Thanks,

Matt

  • 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-18T02:11:05+00:00Added an answer on May 18, 2026 at 2:11 am

    Any help would be greatly appreciated.

    The error is not in the code you posted. The Text property of a TextBox, and the reference to a Form Textbox don’t become null all of a sudden.

    You probably have to debug into initSearch

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this page which loads quotes. It has a search form wherein if
I have a form which has a lot of SELECTs. For various reasons, I'd
I have a ASP.NET page which has a form on it. It also has
I have an ASP.NET page which has a script manager on it. <form id=form1
I have a an HTML form which contains the YAHOO rich text editor on
I have a form 'pub_form' which has function $form['#theme'] = 'publication_order'; so in module
I have this html form which has options: <tr> <td width=30 height=35><font size=3>*List:</td> <td
I have a simple web form which has a couple list boxes and a
I have a form in MS Access which has an image. The image has
Say I have a Form object which has an array of Tab objects. var

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.