473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

isnull in C#

How do I checkif a string is empty in C# like isNull(string) in VB?
regards
reidarT
Nov 16 '05 #1
6 121553
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 16 '05 #2
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer

Nov 16 '05 #3
I get the message, null is not exist in the class or namespace

reidarT
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> skrev
i melding news:%2****************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...
How do I checkif a string is empty in C# like isNull(string) in VB?
regards


if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer


Nov 16 '05 #4
PP
I used the code as follows as it worked.
Note, c# is case-sensitive :-)
if (child == null)
{
strError = "Some Error";
return false;
}


"ReidarT" wrote:
I get the message, null is not exist in the class or namespace

reidarT
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> skrev
i melding news:%2****************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null

Chris

"Joanna Carter (TeamB)" <jo*****@nospamforme.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"ReidarT" <re****@eivon.no> a écrit dans le message de news:
Oq**************@TK2MSFTNGP10.phx.gbl...

How do I checkif a string is empty in C# like isNull(string) in VB?
regards

if (string = null)

Joanna

--
Joanna Carter
Consultant Software Engineer



Nov 16 '05 #5
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> a
écrit dans le message de news: #y**************@TK2MSFTNGP14.phx.gbl...
if (string = null) //Doesn't this assign null to string?
if (string == null) //This is what you want, to check if string is null


Yup, still trying to juggle Delphi and C# :-)) Would you believe, I used to
do C++ until about 10 years ago?

Joanna

--
Joanna Carter
Consultant Software Engineer
Nov 16 '05 #6
> Yup, still trying to juggle Delphi and C# :-)) Would you believe, I used to
do C++ until about 10 years ago?


me too, we have similar backgrounds. I've got over a hundred legacy
Delphi programs and I'm slowly migrating to C#.

Eric
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Cottis | last post by:
I am getting wierd behaviour with IsNull in ASP. I am passing a string (which may be null) to a function. When the string is null, IsNull seems to return false the first time it is called, then...
2
by: Trev | last post by:
I have two tables, tblMTO and tblIMPORT_MTO. If I import an entire MTO into the import table I want to create a delta from it (i.e. leave only the changed items). I have a view (simplified) ...
6
by: Martin | last post by:
Dear Group Just wondered how I can avoid the CHAR(32) to be inserted if @String1 is NULL? SET @String3 = ISNULL(@String1,'') + CHAR(32) + ISNULL(@String2,'') Thanks very much for your...
6
by: Eric J Owens | last post by:
TIA! I recently moved some forms from an a2k mdb file to an a2k adp. There is now an error when opening one of the forms 'the isnull function requires 2 arguments', but I only find references...
4
by: Paul Spratley | last post by:
Hi all Firstly this my first time posting to technical groups - so any mistakes I apologise for in advance. I am trying to count records in several secondary tables for the same run in a...
2
by: Raoul Watson | last post by:
I have used isNull statement for as long as I have used VB.. Recently I am devugging a program and it is very clear that the "IsNull" function sometimes would return a true even when the value is...
16
by: madeleine | last post by:
Please can someone help me, I think I may go mad with this one: Do While Not IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate))) If IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate)))...
4
by: jimm.sander | last post by:
Hello, Problem: Im using isnull() in vbscript to determine if a field returned from a ado object call is in fact null. The problem is when I use isnull in anything other than a response.write()...
16
kcdoell
by: kcdoell | last post by:
Hello: When I write new record I have the following code: Private Sub Form_BeforeUpdate(Cancel As Integer) Me!RowIsActive = False 'When a user is creating a new record the following...
1
by: krishnaroopa | last post by:
I have a sequence of 20 stored procedures executed to produce the final output. In almost all procedures, i have a table lookup. The query is something similar to shown below: SELECT * FROM...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.