Click here to Skip to main content
15,914,419 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Excel -- Using oledb -- getting dbnull when it's not Pin
Marcus J. Smith14-Feb-07 5:40
professionalMarcus J. Smith14-Feb-07 5:40 
GeneralRe: Excel -- Using oledb -- getting dbnull when it's not Pin
nlarson1114-Feb-07 5:54
nlarson1114-Feb-07 5:54 
Questionadding button in dataGrid Pin
costavo14-Feb-07 4:05
costavo14-Feb-07 4:05 
AnswerRe: adding button in dataGrid [modified] Pin
Marcus J. Smith14-Feb-07 4:06
professionalMarcus J. Smith14-Feb-07 4:06 
QuestionHow to extract a zip using vb.net Pin
Navas.M14-Feb-07 3:27
Navas.M14-Feb-07 3:27 
AnswerRe: How to extract a zip using vb.net Pin
andyharman14-Feb-07 6:44
professionalandyharman14-Feb-07 6:44 
QuestionRedundancy seems to be my game to avoid Null Reference and Index Out of Range Exceptions - HELP! Pin
Marcus J. Smith14-Feb-07 2:16
professionalMarcus J. Smith14-Feb-07 2:16 
AnswerRe: Redundancy seems to be my game to avoid Null Reference and Index Out of Range Exceptions - HELP! Pin
Colin Angus Mackay14-Feb-07 5:02
Colin Angus Mackay14-Feb-07 5:02 
cleako wrote:
I almost always perform 2 checks on a string and include a trim no matter what.

If strValue IsNot Nothing AndAlso strValue.Trim <> "" Then


If you are using .NET 2.0 this can be shortened to
If Not String.IsNullOrEmpty(strValue) Then
NOTE: It doesn't trim the string first.


cleako wrote:
What I am curious about is should I always perform the .Trim or is if strValue = " " considered 0 length?


" " is considered to be not empty. An empty string contains zero characters.


cleako wrote:
If dr.Item("ColumnName") IsNot DBNull AndAlso dr.Item("ColumnName") IsNot Nothing AndAlso dr.Item("ColumnName").ToString.Trim <> "" Then

How much of that is necessary?


It depends on what you are checking for. You could make it more efficient by assigning the result to a local variable first then it doesn't have to repeatedly look up the value for the column.

Personally, if you are having to trim whitespace off the strings all the time I'd tread that as a data error and would try to clean the data at source first. NOTE: if you are using a CHAR column in the database then it will always space pad the value. I'd recommend moving to VARCHAR unless you have a compelling reason to stay with CHAR (e.g. A legacy system you share the database with would freak if it wasn't space padded)


Questionhelp for MenuItem for VB.Net Compact Framework Pin
danaelx14-Feb-07 0:37
danaelx14-Feb-07 0:37 
Questionwhat is handle in .net Pin
saravanaks13-Feb-07 23:59
saravanaks13-Feb-07 23:59 
AnswerRe: what is handle in .net Pin
Christian Graus14-Feb-07 0:35
protectorChristian Graus14-Feb-07 0:35 
AnswerRe: what is handle in .net Pin
Thomas Stockwell15-Feb-07 14:26
professionalThomas Stockwell15-Feb-07 14:26 
Questionhow could I use the values of the dataGrid Pin
costavo13-Feb-07 23:52
costavo13-Feb-07 23:52 
AnswerRe: how could I use the values of the dataGrid Pin
Marcus J. Smith14-Feb-07 2:09
professionalMarcus J. Smith14-Feb-07 2:09 
AnswerRe: how could I use the values of the dataGrid Pin
Rahul Appu14-Feb-07 2:12
Rahul Appu14-Feb-07 2:12 
GeneralRe: how could I use the values of the dataGrid Pin
costavo14-Feb-07 2:19
costavo14-Feb-07 2:19 
QuestionRe: how could I use the values of the dataGrid Pin
costavo14-Feb-07 2:32
costavo14-Feb-07 2:32 
AnswerRe: how could I use the values of the dataGrid Pin
Marcus J. Smith14-Feb-07 2:52
professionalMarcus J. Smith14-Feb-07 2:52 
QuestionOpen Directory Pin
lone_wolf35113-Feb-07 23:34
lone_wolf35113-Feb-07 23:34 
AnswerRe: Open Directory Pin
Christian Graus14-Feb-07 0:39
protectorChristian Graus14-Feb-07 0:39 
GeneralRe: Open Directory Pin
lone_wolf35114-Feb-07 0:45
lone_wolf35114-Feb-07 0:45 
AnswerRe: Open Directory Pin
WestSideRailways14-Feb-07 7:33
WestSideRailways14-Feb-07 7:33 
GeneralRe: Open Directory Pin
Dave Kreskowiak14-Feb-07 16:14
mveDave Kreskowiak14-Feb-07 16:14 
GeneralRe: Open Directory Pin
WestSideRailways14-Feb-07 21:45
WestSideRailways14-Feb-07 21:45 
GeneralRe: Open Directory Pin
Dave Kreskowiak15-Feb-07 4:25
mveDave Kreskowiak15-Feb-07 4:25 

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.