Click here to Skip to main content
15,916,835 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionUpdating datasource through dataset and dataadapter Pin
Priya Haridas27-Sep-05 16:35
Priya Haridas27-Sep-05 16:35 
QuestionHow to parse a string with double quotes Pin
j1webb27-Sep-05 9:43
j1webb27-Sep-05 9:43 
GeneralRe: How to parse a string with double quotes Pin
namazikhah27-Sep-05 11:20
namazikhah27-Sep-05 11:20 
GeneralRe: How to parse a string with double quotes Pin
Colin Angus Mackay27-Sep-05 11:56
Colin Angus Mackay27-Sep-05 11:56 
GeneralRe: How to parse a string with double quotes Pin
rwestgraham27-Sep-05 18:12
rwestgraham27-Sep-05 18:12 
AnswerRe: How to parse a string with double quotes Pin
_mubashir27-Sep-05 18:47
_mubashir27-Sep-05 18:47 
AnswerRe: How to parse a string with double quotes Pin
Edbert P27-Sep-05 20:59
Edbert P27-Sep-05 20:59 
AnswerRe: How to parse a string with double quotes Pin
j1webb28-Sep-05 3:58
j1webb28-Sep-05 3:58 
I really appreciate all of the help and it gave me some good ideas which I was able to apply and solve my problem.

For me, the key was removing the "phrases" from the string and placing them in their own array.

First I counted the number of double quotes and divided by 2. That gave me the number of "phrases" I had in the string.

Then I split the string using doublequotes as the delimiter, but I did this one at a time and then removed the "phrase" from the original string, placed it in an array and then split the string again.

Dim doublequote As String = Chr(34)

If InStr(Keyword, doublequote) Then
For i = 0 To intQuoteCount - 1
Dim arrFilename() As String
arrFilename = Split(Keyword, doublequote)
strRemainder0 = arrFilename(0).Trim
strRemainder1 = arrFilename(1).Trim
strPhrase(i) = strRemainder1
Keyword = Replace(Keyword, strRemainder1, "")
strTmp = doublequote & doublequote
Keyword = Replace(Keyword, strTmp, "")
Next i
Keyword = Replace(Keyword, doublequote, "")
End If

Then I split the string using " " as the delimiter. That put all of the words that were left in another array, KeywordsForSearch. Then I expanded that array by the number of elements I had in the strPhrase array and then added the elements from the strPhrase array to the KeywordsForSearch array.
'
Keyword = Replace(Keyword, ",", " ")
' Just in case there are some single quotes in the search string
Keyword = Replace(Keyword, "'", "''")
' In case there are double spaces in the string
Keyword = Replace(Keyword, " ", " ")
'Read in the search words to be searched
KeywordsForSearch = Split(Trim(Keyword), " ")
Keyword = Replace(Keyword, "''", "'")
Dim strKeyWord As String
Dim intArrayCount As Integer = UBound(KeywordsForSearch)
intArrayCount = intArrayCount + intQuoteCount

ReDim Preserve KeywordsForSearch(intArrayCount)
i = 0
intArrayCount = intArrayCount - 1
For i = 0 To intQuoteCount - 1
KeywordsForSearch(intArrayCount) = strPhrase(i)
intArrayCount = intArrayCount + 1
Next i

I'm sure this is not the most elegant solution and someone with more logical thought processes could probably clean this up considerably, but it does work.

Perhaps someone else might want to take this idea and improve on it.



Questionhow to create a copy of database using SqlDMO Pin
Asmakhan27-Sep-05 7:11
Asmakhan27-Sep-05 7:11 
AnswerRe: how to create a copy of database using SqlDMO Pin
rwestgraham27-Sep-05 11:42
rwestgraham27-Sep-05 11:42 
Questionhurry plz!!!!(activex control or how to use optical pen & too scanner in vb.net Pin
pantaloo27-Sep-05 6:59
pantaloo27-Sep-05 6:59 
AnswerRe: hurry plz!!!!(activex control or how to use optical pen & too scanner in vb.net Pin
namazikhah27-Sep-05 11:37
namazikhah27-Sep-05 11:37 
QuestionNeed an example, Please Pin
Funkytroll0127-Sep-05 6:55
Funkytroll0127-Sep-05 6:55 
AnswerRe: Need an example, Please Pin
Dave Kreskowiak27-Sep-05 7:07
mveDave Kreskowiak27-Sep-05 7:07 
QuestionQuestion 'bout buffer and parameters Pin
borini27-Sep-05 6:00
borini27-Sep-05 6:00 
QuestionPassing Command Parameter to Opened File! Pin
psyq27-Sep-05 1:35
psyq27-Sep-05 1:35 
AnswerRe: Passing Command Parameter to Opened File! Pin
Christian Graus27-Sep-05 1:47
protectorChristian Graus27-Sep-05 1:47 
Questionhow to print a Grid control values Pin
snprani27-Sep-05 1:05
snprani27-Sep-05 1:05 
QuestionExtract Error line Number Pin
HemaRawat27-Sep-05 0:34
HemaRawat27-Sep-05 0:34 
AnswerRe: Extract Error line Number Pin
Dave Kreskowiak27-Sep-05 4:30
mveDave Kreskowiak27-Sep-05 4:30 
GeneralRe: Extract Error line Number Pin
HemaRawat27-Sep-05 17:56
HemaRawat27-Sep-05 17:56 
GeneralRe: Extract Error line Number Pin
Dave Kreskowiak28-Sep-05 1:19
mveDave Kreskowiak28-Sep-05 1:19 
QuestionSaving MSOffice Document Pin
zerokill27-Sep-05 0:18
zerokill27-Sep-05 0:18 
AnswerRe: Saving MSOffice Document Pin
Edbert P27-Sep-05 21:07
Edbert P27-Sep-05 21:07 
GeneralRe: Saving MSOffice Document Pin
zerokill28-Sep-05 17:25
zerokill28-Sep-05 17: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.