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

Visual Basic

 
GeneralRe: Help Pin
nlarson1124-Oct-06 4:23
nlarson1124-Oct-06 4:23 
GeneralRe: Help Pin
Evalee24-Oct-06 4:58
Evalee24-Oct-06 4:58 
QuestionSubstraction in Date datatype [modified] Pin
Newbie_dydy8523-Oct-06 9:54
Newbie_dydy8523-Oct-06 9:54 
AnswerRe: Substraction in Date datatype Pin
Guffa23-Oct-06 10:08
Guffa23-Oct-06 10:08 
AnswerRe: Substraction in Date datatype Pin
Are Jay23-Oct-06 16:03
Are Jay23-Oct-06 16:03 
Questionusercontrols Pin
jon-8023-Oct-06 8:48
professionaljon-8023-Oct-06 8:48 
AnswerRe: usercontrols Pin
atregent23-Oct-06 20:07
atregent23-Oct-06 20:07 
Questiontry history Pin
FlorentBzh23-Oct-06 7:17
FlorentBzh23-Oct-06 7:17 
Hello everybody,

I try to use this "try catch" block :
<br />
   Function DateConvert(ByVal strDate As String) As String<br />
            Dim jj, mm, aa As String<br />
            Dim buf() As String<br />
<br />
            Try<br />
                buf = Split(strDate, "/")<br />
                jj = buf(0)<br />
                mm = buf(1)<br />
                aa = buf(2)<br />
            Catch ex As Exception<br />
                Throw ex<br />
            End Try<br />
<br />
            If (System.Web.Configuration.WebConfigurationManager.AppSettings("OS") = "US") Then<br />
                DateConvert = mm & "/" & jj & "/" & aa<br />
            Else<br />
                DateConvert = jj & "/" & mm & "/" & aa<br />
            End If<br />
<br />
        End Function<br />


When I pass a string with a bad date format like "02/2006" or "" instead of "23/10/2006"
I get this error : "Index was outside the bounds of the array."

The "try catch" block must catch this type of error but not there... why ?

Please, my code doesn't look bad but I don't find where I'm wrong...

PS1 : I also try with an IndexOutOfRangeException exception with the same result !!
PS2 : I use the Framework 2.0...
AnswerRe: try history Pin
Ray Cassick23-Oct-06 7:36
Ray Cassick23-Oct-06 7:36 
QuestionRe: try history [modified] Pin
FlorentBzh23-Oct-06 22:39
FlorentBzh23-Oct-06 22:39 
AnswerRe: try history Pin
Dave Kreskowiak24-Oct-06 4:47
mveDave Kreskowiak24-Oct-06 4:47 
AnswerRe: try history Pin
nlarson1123-Oct-06 8:12
nlarson1123-Oct-06 8:12 
QuestionBase64 class in VB.NET Pin
winmedia23-Oct-06 6:00
winmedia23-Oct-06 6:00 
AnswerRe: Base64 class in VB.NET Pin
Guffa23-Oct-06 8:11
Guffa23-Oct-06 8:11 
GeneralRe: Base64 class in VB.NET Pin
winmedia24-Oct-06 5:07
winmedia24-Oct-06 5:07 
AnswerRe: Base64 class in VB.NET Pin
Guffa24-Oct-06 6:42
Guffa24-Oct-06 6:42 
QuestionProgress Bar Pin
jds120723-Oct-06 5:46
jds120723-Oct-06 5:46 
AnswerRe: Progress Bar Pin
Are Jay23-Oct-06 15:28
Are Jay23-Oct-06 15:28 
AnswerRe: Progress Bar Pin
Dave Kreskowiak24-Oct-06 4:46
mveDave Kreskowiak24-Oct-06 4:46 
QuestionCrystal Reports Field View Pin
Silver-Grey23-Oct-06 5:35
Silver-Grey23-Oct-06 5:35 
QuestionAddin - Disabling CommandBarPopup in Code Window Context Menu [modified] Pin
dlarkin7723-Oct-06 2:19
dlarkin7723-Oct-06 2:19 
Questionvs.net - / vb.net 2005 Pin
Pete Newman22-Oct-06 23:53
Pete Newman22-Oct-06 23:53 
AnswerRe: vs.net - / vb.net 2005 Pin
Dave Sexton23-Oct-06 0:50
Dave Sexton23-Oct-06 0:50 
GeneralRe: vs.net - / vb.net 2005 Pin
Pete Newman23-Oct-06 1:03
Pete Newman23-Oct-06 1:03 
GeneralRe: vs.net - / vb.net 2005 Pin
Dave Sexton23-Oct-06 4:19
Dave Sexton23-Oct-06 4:19 

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.