|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
How to check for null in txtbox and do somthing?
Hello.
I am using visual basic 6. I have 20 textboxes and i have to load records into the textboxes. After loading, those who have null values inside the textbox, they shall be set to visible = false. Wat can i do abt it? Thanks. |
|
#2
|
||||
|
||||
|
If txtYourTextBox = vbNullString Then
txtYourTextBox.Visible = False End If |
|
#3
|
|||
|
|||
|
Hello Onslaught.
Thanks again for reply my post. I wonder whether there is a method tt there is no need to repeat the the above coding for 20 times for each textboxes. Thanks. You are good! Man ![]() |
|
#4
|
||||
|
||||
|
Would be best if the text boxes were an array of the same control. It would make loading and interacting with them a lot easier.
The only other way I would know how to automate it would be to check every control on the form and see if it is a textbox and if it is then to do the check on that control. Something like: Code:
For Each obj In Me.Controls
If TypeOf obj = TextBox Then
If obj = vbNullString Then
obj.Visible = False
End If
End If
Next
|
|
#5
|
|||
|
|||
|
Onslaught nice code but please check the syntax!
U r causing an error if that is used If TypeOf obj = TextBox Then ? Code:
For Each obj In Me.Controls
If TypeOf obj Is TextBox Then 'should be Is..?
If obj = vbNullString Then
obj.Visible = False
End If
End If
Next
__________________
I May Have Misinterpret U'r Post Correct Me If I Am Wrong......// Enjoy Coding........................../// zak2zak |
|
#6
|
||||
|
||||
|
I said is was untested, was going from memory
you are correct though I believe |
|
#7
|
|||
|
|||
|
thanks onslaught...!
Quote:
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > How to check for null in txtbox and do somthing? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|