We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,878 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Checking if textbox is empty

Hello masters,

I want to know how to check an empty textbox in the form.
I can check it by assign Text1.Text = "".
But i have many textbox in form.

Thank you in advance

2
Contributors
2
Replies
3 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
Sturdy
Light Poster
39 posts since Mar 2011
Reputation Points: 28
Solved Threads: 1
Skill Endorsements: 0

Try this :

Dim ctrAs Control

For Each ctr In Me.Controls
   If TypeOf ctr Is TextBox Then
      If ctr.Text= vbNullString Then
         MsgBox "Textbox empty"

         ctr.SetFocus

         Exit Sub

      End If
  End If
Next ctr
Jx_Man
Senior Poster
3,527 posts since Nov 2007
Reputation Points: 1,482
Solved Threads: 515
Skill Endorsements: 64
Question Answered as of 1 Year Ago by Jx_Man

Thank you sir for wonderful code..

Sturdy
Light Poster
39 posts since Mar 2011
Reputation Points: 28
Solved Threads: 1
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0746 seconds using 2.64MB