Click here to Skip to main content
15,925,081 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Silently blocking all keyboard input for RichTextBox Pin
nlarson1114-Nov-07 8:21
nlarson1114-Nov-07 8:21 
GeneralRe: Silently blocking all keyboard input for RichTextBox Pin
supercat914-Nov-07 9:37
supercat914-Nov-07 9:37 
Questionhow to locate wifi node Pin
umershahbaz14-Nov-07 6:30
umershahbaz14-Nov-07 6:30 
AnswerRe: how to locate wifi node Pin
Dave Kreskowiak14-Nov-07 7:12
mveDave Kreskowiak14-Nov-07 7:12 
AnswerRe: how to locate wifi node Pin
Baddog_52017-Nov-07 16:23
Baddog_52017-Nov-07 16:23 
QuestionExeption handling in VB.net Pin
supercat914-Nov-07 6:19
supercat914-Nov-07 6:19 
AnswerRe: Exeption handling in VB.net Pin
Dave Kreskowiak14-Nov-07 6:57
mveDave Kreskowiak14-Nov-07 6:57 
GeneralRe: Exeption handling in VB.net Pin
supercat914-Nov-07 9:02
supercat914-Nov-07 9:02 
It depends entirely on your business rules and what you want/need to do with the good and bad lines in the data.



Hmm... I just did a different query in the help file and found that the dateTime has a 'tryparse' method which does almost what I'm after, though the section of the help file on converting strings to other types didn't mention it for some reason.

I guess my more general question is what one is supposed to do if generic exception handlers are bad, if one doesn't really care about the specifics of any of the normal failure cases, and if there's no convenient way to determine in advance if an operation will work. If I allow the user to type in a number which should be in the range -1E250 to +1E250 and wish to validate it, must I look up the cdbl() function to determine what exceptions can be 'normally' thrown and then explicitly handle all of those? I would think it easier to make a little wrapper function:

function safedbl(st as string, defaultVal as double) as double
  safedbl=defaultVal
  try
    safedbl=cdbl(st)
  catch ' Who cares what went wrong?
  end try
end function

but I understand generic catch instructions are frowned upon in such contexts. How else, though, can I validate the input to ensure that it will work?

If I didn't have to accept anything other than positive decimal integers, I could check to ensure the string contained only digits and wasn't obscenely long. I suppose the 'like' operator could probably used to individually check for all valid numeric formats, but that seems rather a waste. What's the 'right' approach?
GeneralRe: Exeption handling in VB.net Pin
Dave Kreskowiak14-Nov-07 10:20
mveDave Kreskowiak14-Nov-07 10:20 
GeneralRe: Exeption handling in VB.net Pin
supercat914-Nov-07 10:45
supercat914-Nov-07 10:45 
GeneralRe: Exeption handling in VB.net Pin
Dave Kreskowiak14-Nov-07 10:53
mveDave Kreskowiak14-Nov-07 10:53 
GeneralRe: Exeption handling in VB.net Pin
supercat914-Nov-07 12:05
supercat914-Nov-07 12:05 
AnswerRe: connection to SQL server stays open Pin
Dave Kreskowiak14-Nov-07 6:11
mveDave Kreskowiak14-Nov-07 6:11 
QuestionNibbles Pin
No-e14-Nov-07 6:05
No-e14-Nov-07 6:05 
AnswerRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 6:26
mveDave Kreskowiak14-Nov-07 6:26 
GeneralRe: Nibbles Pin
supercat914-Nov-07 6:30
supercat914-Nov-07 6:30 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 6:49
mveDave Kreskowiak14-Nov-07 6:49 
GeneralRe: Nibbles Pin
supercat914-Nov-07 6:56
supercat914-Nov-07 6:56 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 7:16
mveDave Kreskowiak14-Nov-07 7:16 
GeneralRe: Nibbles Pin
supercat914-Nov-07 9:40
supercat914-Nov-07 9:40 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 12:57
mveDave Kreskowiak14-Nov-07 12:57 
GeneralRe: Nibbles Pin
nlarson1114-Nov-07 7:40
nlarson1114-Nov-07 7:40 
GeneralRe: Nibbles Pin
Dave Kreskowiak14-Nov-07 8:22
mveDave Kreskowiak14-Nov-07 8:22 
GeneralRe: Nibbles Pin
nlarson1114-Nov-07 8:26
nlarson1114-Nov-07 8:26 
Questionform closing error Pin
Tom Deketelaere14-Nov-07 4:07
professionalTom Deketelaere14-Nov-07 4:07 

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.