There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
black screen blue screen boot computer connection crash css dell display driver drivers error excel firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems ram router slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Dont run function if text box empty in VB


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
B3gbie's Avatar
Senior Member with 242 posts.
 
Join Date: Nov 2001
Location: Banoldswick, England
18-Jan-2002, 10:10 AM #1
Dont run function if text box empty in VB
I'm trying to return an error if a particular text box is empty,
if txtWhatever.text ="" Then doesnt work, I have some code to convert null values to empty strings but it doesnt want to work with this bit, any help would be appreciated.
Harryc's Avatar
Junior Member with 11 posts.
 
Join Date: May 2000
Location: Kent, UK
18-Jan-2002, 11:45 AM #2
Is the test for valid text being executed? Start a new project and put a text box on the form. Clear the default text from the box and in the form unload event put

If Text1.text = "" Then
Msgbox "Error"
Cancel = 1
Endif

Try it by running the project and closing the form. If there is nothing in the text box you will get the error message and the form will remain displayed. If you do the same thing after putting something in the text box the project will terminate.
Why are you looking for nulls in a text box, as far as I am aware a text box can never have a null value.
B3gbie's Avatar
Senior Member with 242 posts.
 
Join Date: Nov 2001
Location: Banoldswick, England
18-Jan-2002, 11:55 AM #3
Found the problem, had tried your solution but with no joy, turns out I was calling the function with an integer, hence the error, thanks for your help anyway though, i didn't know about the null bit.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:26 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.