If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then....
If 'x' is Not Null then.... If 'x' is Not Null then....
If 'x' is Not Null then....
Go Back  Xtreme Visual Basic Talk > > > If 'x' is Not Null then....


Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2009, 08:14 AM
VB-Beginner-09 VB-Beginner-09 is offline
Newcomer
 
Join Date: Mar 2009
Posts: 10
Default If 'x' is Not Null then....


Whats the syntax for 'Not Null' or for when a field contains a value?

I'm trying to make a flag be set when a textbox contains a value, but I don't know how to write the code to do this.

Thanks
Reply With Quote
  #2  
Old 03-22-2009, 08:20 AM
user name user name is offline
Junior Contributor
 
Join Date: Sep 2004
Posts: 264
Default

Because a textbox returns a string, you can use this.

If Textbox1.Text <> String.Empty Then

or

If Textbox1.Text <> "" Then
Reply With Quote
  #3  
Old 03-22-2009, 09:30 AM
VB-Beginner-09 VB-Beginner-09 is offline
Newcomer
 
Join Date: Mar 2009
Posts: 10
Default

Thanks mate, I actually worked it out myself in the end but much appreciated all the same.

Dediced to use If Textbox.text <> Nothing Then...
Reply With Quote
  #4  
Old 03-23-2009, 05:13 AM
jo0lsIf 'x' is Not Null then.... jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

The <> operator translates to Not Equals, so it would call the Equals method, which would then test for Nothing. A more direct approach would be:
If TextBox1.Text IsNot Nothing Then

But, you might as well use:
If Not String.IsNullOrEmpty(TextBox1.Text) Then
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then.... If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then.... If 'x' is Not Null then....
If 'x' is Not Null then....
If 'x' is Not Null then....
 
If 'x' is Not Null then....
If 'x' is Not Null then....
 
-->