Click here to Skip to main content
15,890,825 members
Home / Discussions / C#
   

C#

 
Questionstring conversion Pin
Brendan Vogt9-Oct-05 21:55
Brendan Vogt9-Oct-05 21:55 
AnswerRe: string conversion Pin
Maqsood Ahmed10-Oct-05 0:11
Maqsood Ahmed10-Oct-05 0:11 
AnswerRe: string conversion Pin
S. Senthil Kumar10-Oct-05 2:05
S. Senthil Kumar10-Oct-05 2:05 
GeneralRe: string conversion Pin
Brendan Vogt10-Oct-05 2:39
Brendan Vogt10-Oct-05 2:39 
GeneralRe: string conversion Pin
S. Senthil Kumar10-Oct-05 3:03
S. Senthil Kumar10-Oct-05 3:03 
QuestionRe: string conversion Pin
Brendan Vogt11-Oct-05 0:44
Brendan Vogt11-Oct-05 0:44 
AnswerRe: string conversion Pin
Maqsood Ahmed11-Oct-05 20:55
Maqsood Ahmed11-Oct-05 20:55 
QuestionRe: string conversion Pin
Brendan Vogt11-Oct-05 22:04
Brendan Vogt11-Oct-05 22:04 
Thanks for the reply.

I just want to get back to your other method you mentined a couple of days:

Method:
public static string GetString(string textBoxString)<br />
{<br />
     if(textBoxString.Trim() != string.Empty)<br />
          return textBoxString.Trim();<br />
     else<br />
          return null;<br />
}


Usage:
string strName = MyClass.GetString(txtName.Text);

Your return type is a string. If it containe a null, won't it complain because your return type is a null?

If I want to create a similar function like this to return DBNull.Value, can I do the above mentioned if, if enmpty, the I return DBNull.Value? Is this the right way to coding it?


Maqsood Ahmed wrote:
strName.Length property will do.

What if it is an int value?


Maqsood Ahmed wrote:
No, null is not similar to DBNull.Value

When I have a variable that is null and add it to my table, then it seems to add a null value to the field, nulls values look like <null> in SQL Server 2000?

Regards
AnswerRe: string conversion Pin
Maqsood Ahmed12-Oct-05 20:13
Maqsood Ahmed12-Oct-05 20:13 
QuestionRe: string conversion Pin
Brendan Vogt12-Oct-05 20:33
Brendan Vogt12-Oct-05 20:33 
GeneralRe: string conversion Pin
Brendan Vogt17-Oct-05 22:12
Brendan Vogt17-Oct-05 22:12 
QuestionTimeline controls in C# Pin
jpvanoosten9-Oct-05 21:53
jpvanoosten9-Oct-05 21:53 
Questionnull string Pin
Brendan Vogt9-Oct-05 21:52
Brendan Vogt9-Oct-05 21:52 
AnswerRe: null string Pin
Maxim Ignatyev9-Oct-05 22:35
Maxim Ignatyev9-Oct-05 22:35 
AnswerRe: null string Pin
S. Senthil Kumar10-Oct-05 2:08
S. Senthil Kumar10-Oct-05 2:08 
AnswerRe: null string Pin
XRaheemX10-Oct-05 4:58
XRaheemX10-Oct-05 4:58 
QuestionDebugging class library (DLL) Pin
raed9-Oct-05 21:52
raed9-Oct-05 21:52 
AnswerRe: Debugging class library (DLL) Pin
S. Senthil Kumar10-Oct-05 2:15
S. Senthil Kumar10-Oct-05 2:15 
GeneralRe: Debugging class library (DLL) Pin
raed10-Oct-05 2:44
raed10-Oct-05 2:44 
QuestionPage.IsPostBack Pin
Brendan Vogt9-Oct-05 21:47
Brendan Vogt9-Oct-05 21:47 
AnswerRe: Page.IsPostBack Pin
David Stone10-Oct-05 5:43
sitebuilderDavid Stone10-Oct-05 5:43 
QuestionHelp required on remote objects in C# Pin
kschakravarthy9-Oct-05 20:41
kschakravarthy9-Oct-05 20:41 
AnswerRe: Help required on remote objects in C# Pin
S. Senthil Kumar10-Oct-05 2:19
S. Senthil Kumar10-Oct-05 2:19 
GeneralRe: Help required on remote objects in C# Pin
kschakravarthy10-Oct-05 20:56
kschakravarthy10-Oct-05 20:56 
QuestionProcess Large File Results Server Application Unavailable Pin
Member 14325389-Oct-05 20:00
Member 14325389-Oct-05 20:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.