Click here to Skip to main content
15,890,690 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to download all latest files from ftp server to pc automatically in vb.net Pin
Member 1295777522-Jan-17 21:09
Member 1295777522-Jan-17 21:09 
GeneralRe: How to download all latest files from ftp server to pc automatically in vb.net Pin
NotPolitcallyCorrect23-Jan-17 2:20
NotPolitcallyCorrect23-Jan-17 2:20 
QuestionHow to download all latest files from ftp server to pc automatically in vb.net Pin
Member 1295777522-Jan-17 15:07
Member 1295777522-Jan-17 15:07 
QuestionIsolating text within a text box Pin
Member 1296154621-Jan-17 13:27
Member 1296154621-Jan-17 13:27 
AnswerRe: Isolating text within a text box Pin
NotPolitcallyCorrect21-Jan-17 15:13
NotPolitcallyCorrect21-Jan-17 15:13 
Questionvb.net 2010 code check if values exist Pin
dcof19-Jan-17 12:00
dcof19-Jan-17 12:00 
AnswerRe: vb.net 2010 code check if values exist Pin
NotPolitcallyCorrect19-Jan-17 13:38
NotPolitcallyCorrect19-Jan-17 13:38 
AnswerRe: vb.net 2010 code check if values exist Pin
Richard Deeming20-Jan-17 2:04
mveRichard Deeming20-Jan-17 2:04 
If the substring isn't found, IndexOf returns -1. You'll need to find and store each index first, then check that they're not -1 before calling Substring.

Also, IndexOf already returns an Integer. There's no need to call CInt.
Dim startIndex As Integer = _attendanceLetterOrig.IndexOf("ADDR_BEG")
Dim endIndex As Integer = _attendanceLetterOrig.IndexOf("ADDR_END", startIndex)
If startIndex <> -1 AndAlso endIndex <> -1 Then
    Dim txtOrigAddress As String = _attendanceLetterOrig.Substring(startIndex, endIndex - startIndex)
End If


Your second example makes no sense. The IndexOf method returns the index of the start of the matched substring, if found. So _attendanceLetterOrig.IndexOf("ADDR_NEXT") returns the index of "A", and _attendanceLetterOrig.Substring(..., 4) will always return "ADDR".



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


Questionvb.net menu strip Pin
Member 1295543917-Jan-17 19:32
Member 1295543917-Jan-17 19:32 
QuestionRe: vb.net menu strip Pin
Richard MacCutchan17-Jan-17 22:23
mveRichard MacCutchan17-Jan-17 22:23 
AnswerRe: vb.net menu strip Pin
Dave Kreskowiak18-Jan-17 4:18
mveDave Kreskowiak18-Jan-17 4:18 
Questiondynamically generated custom class datagridview cellmousedoubleclick event Pin
Yiğit Sertaç Subaşı17-Jan-17 2:28
Yiğit Sertaç Subaşı17-Jan-17 2:28 
AnswerRe: dynamically generated custom class datagridview cellmousedoubleclick event Pin
Eddy Vluggen17-Jan-17 4:32
professionalEddy Vluggen17-Jan-17 4:32 
AnswerRe: dynamically generated custom class datagridview cellmousedoubleclick event Pin
Yiğit Sertaç Subaşı18-Jan-17 0:03
Yiğit Sertaç Subaşı18-Jan-17 0:03 
GeneralRe: dynamically generated custom class datagridview cellmousedoubleclick event Pin
Eddy Vluggen18-Jan-17 4:41
professionalEddy Vluggen18-Jan-17 4:41 
GeneralRe: dynamically generated custom class datagridview cellmousedoubleclick event Pin
Yiğit Sertaç Subaşı19-Jan-17 6:04
Yiğit Sertaç Subaşı19-Jan-17 6:04 
GeneralRe: dynamically generated custom class datagridview cellmousedoubleclick event Pin
Eddy Vluggen19-Jan-17 8:45
professionalEddy Vluggen19-Jan-17 8:45 
Question7 zip the folder part by part using vbscript Pin
Member 126754616-Jan-17 20:14
Member 126754616-Jan-17 20:14 
AnswerRe: 7 zip the folder part by part using vbscript Pin
Eddy Vluggen17-Jan-17 4:30
professionalEddy Vluggen17-Jan-17 4:30 
QuestionHow to embed Excel in web browser in vb .net Pin
Member 887818616-Jan-17 2:27
Member 887818616-Jan-17 2:27 
AnswerRe: How to embed Excel in web browser in vb .net Pin
Eddy Vluggen16-Jan-17 2:31
professionalEddy Vluggen16-Jan-17 2:31 
QuestionMessage Closed Pin
15-Jan-17 4:41
Live for Coding15-Jan-17 4:41 
AnswerRe: How to get JSON data into array Pin
Richard MacCutchan15-Jan-17 22:59
mveRichard MacCutchan15-Jan-17 22:59 
QuestionExcel open as ADODB.Connection Pin
hansoctantan12-Jan-17 2:24
professionalhansoctantan12-Jan-17 2:24 
AnswerRe: Excel open as ADODB.Connection Pin
Dave Kreskowiak12-Jan-17 2:45
mveDave Kreskowiak12-Jan-17 2:45 

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.