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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:12:11+00:00 2026-05-19T04:12:11+00:00

I want to create a textbox which contents are validated every time the text

  • 0

I want to create a textbox which contents are validated every time the text in it changes. And an image is displayed beside the textbox if it is correct and another image shows up if its not correct. Pretty much like ajax.

Heres the method which I called from the class.

Public Sub read1()
    cmd.CommandText = "SELECT * FROM testdb WHERE Name='" & name & "'"
    Try
        rdr = cmd.ExecuteReader
        Dim n As String
        If rdr.HasRows Then
            n = rdr("Name").ToString
            Form1.PictureBox1.Image = Image.FromFile("C:\wamp\www\Dropbox\Public\Check-icon.png")



        Else
            Form1.PictureBox1.Image = Image.FromFile("C:\wamp\www\Dropbox\Public\Delete-icon.png")

        End If


        Catch ex As Exception

And here the event which calls for the method:

 Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        x.name = TextBox1.Text
        x.read1()

    End Sub

    End Try

End Sub

Problem is, the method seems to be only called once. And the first image that was displayed stays the same even after inputting a data which does not exist in the database.
I’m connecting this program to a mysql database using odbc. Can you help me determine whats the problem and how to fix it?

Heres the screenshot:
alt text

  • 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-19T04:12:12+00:00Added an answer on May 19, 2026 at 4:12 am

    With a DataReader object, you have to call the Read method before you can access the row. I think it would need to look like the following. I am guessing at the VB.Net syntax and method name, but I am reasonably sure it would be simply rdr.Read.

        If rdr.HasRows Then
            rdr.Read
            n = rdr("Name").ToString
    

    Edit In addition, you probably need to close the DataReader. Some .NET data providers allow only a single reader to be open at a time on a given connection, and it seems likely that the ODBC provider is one of them. Without a specific call to close it, you would be relying on the garbage collector to clean it up:

    rdr.Close
    

    And while this has nothing to do with the question directly, you should probably use a parameterized query to avoid an SQL injection attack.

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

Sidebar

Related Questions

I want to create a textbox which text binds an integer (e.g 123456789), but
I want to create a TextBox, which would have a gray default text appear
I want to create a user control [textbox] which convert all the text in
i want to create one textbox which accept city or country name and when
I have an IFrame embedding a youtube video. I want to create a textbox
I'm creating a login page. I want to create ASP.NET TextBox controls that have
I want to create span exactly like an input textbox , but inside the
I am using the Html.TextBox helper to create textboxes. I want to set attributes
i want create image animation , i have 50 images with png format now
I want to create a simple gsp page which will have an input box

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.