I'm trying to compare the selected item in a combo box to the items in a collection in search of a match. There is guaranteed to be a match because the combo box was originally populated from the same collection. This is the code I'm using:
[Code]....
This code works for other collections but not for this one. In this case, the loop stops after the first iteration, regardless of what's selected in the combo box. I have confirmed that the collection contains the correct data and that there is a match for the combo box options. The only difference between this instance and other instances is that the values in the collection and in the combo box contain a double quote at the end. I suspect this is what's causing the error. (To be clear, there is no error message, it's simply not returning the correct value.) I've tried various string compare methods but none of them have fixed the problem.
Notice the 2 quotes in bold above. I need to add (return false) so the browser won't scroll to the top of the page when the text label (#) is not found.
Hopefully this question will have an easy answer; I've tried searching for the answer myself, but I don't know what to search for (I don't know what you would call this).
Is there a way to compare a string to see if it matches more than 1 value?
I have two array list same size, depending on the information gathered by previous functions. The size of the arrays range from 2 - 45 in length, both arrays always have the same length. I am trying to match one string in one array to another string in the second array. When they match then add Item to List.
Here is my Do Until i = Arraylenght info = Replace(myAL(s), " ", "") SortedArrayList(m) = Replace(SortedArrayList(m), " ", "") SortedLine = Split(SortedArrayList(m), "Price=") If myAL(s).Contains(SortedLine(1)) Then [Code] .....
This code works up to an array of not more then 4 in lenght, when working larger size array then 4, the minute it get to 5 I get this Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I have two lists of strings. One is a list of all students in a class and the other is a list of students in the class that completed an assignment. The two lists are part:whole. So we have two loops for copying elements and displaying them in a list box for only the students who did submit.
Dim f As Integer f = 0 Dim h As Integer h = 0 While (usersinclass.Count > f) h = 0 While (usersidthatsubmittedassingments.Count > h) [Code] .....
What I need is the remaining portion of the "usersinclass" list. (i.e. The students who did not submit). I tried an Else statement BUT with nested loops, every element is guaranteed not to match at least once, so I was getting elements that shouldn't be there. So, is there anyway to run the given lists against each other again to pull out the remaining students? (preferably with no repeats).
Just wondering if anyone knows why does my authentication server fail at comparing strings? Also is there a better method of comparing strings than what im using below? User types in a textbox then sends text to server, server then checks it
This should create a desktop shortcut but instead it spits out an error that is because of the quotes inside quotes. They need to be there, I know this is the problem as I have tried without them and it has worked. Another problem though is that it creates the shortcut (when Idon'thave quotes in quotes) but wraps the whole TargetPath in quotes making the shortcut unusable. Here is my code:
Dim input As String Dim s As String = Environment.GetEnvironmentVariable("UserProfile") input = TextBox1.Text
Is there any way to use selectnode with the attribute having both single and double quotes? If we are having single quote in the attribute we can use like below,
I cant seem to think this morning.I am trying to compare version strings. These are scraped off a website...
examples:
4.5.0.55 4.2.2.128 4.5.0.37 5.0.0.713
how do i make sure I am grabbing the highest version?right now I have it checking the length, if less than 9 .. add a zero. then remove the .'s and convert to an integer. then just check. I know thats not the best and most accurate.
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
I am working on a UDP Client/Server, and currently i have them sending back and forth strings, which i convert to bytes, and then open the bytes to read. I want to now send an Object instead of those strings, which includes multiple unsigned integers and strings.
I have a list of strings. For each string in that list, I want to prepend another string. I wrote a method to do it, but I was wondering if there was something already in .NET I could use to do this. It seems like something that could be built in, but I was not able to find anything.
Here is the method I wrote:
Private Function PrependToAllInList(ByRef inputList As List(Of String), ByRef prependString As String) As List(Of String) Dim returnList As List(Of String) = New List(Of String) For Each inputString As String In inputList returnList.Add(String.Format("{0}{1}", prependString, inputString))
[code].....
It works, but I would rather use built in functions whenever possible.
I have a xls file, or a csv without quotes, and using vb.net need to turn it into a csv with quotes around every cell. If I open the xls/csv without quotes in MS Access, set every column to text and then export it, its in the format I need. Is there an easier way? If not, how do I do replicate this in vb.net?
I have a string like this:This <span class="highlight">is</span> a very "nice" day!What should my RegEx-pattern in VB look like, to find the quotes within the tag? I want to replace it with something...This <span class=^highlight^>is</span> a very "nice" day!Something like <(")[^>]+> doesn't work :(
I have been looking for examples to find the string between two strings. This top one works fine;
Public Sub ReadData(ByRef keywordStart As String, ByRef keywordEnd As String, ByVal filename As String) Using reader = New StreamReader(filename)
[Code].....
Now the first one is fine - Ext_Volume is result of the string between the strings <Volume> and </Volume>. <Volume> and </Volume> are unique so this is straight forward.
However the second one - "^FDExp:" is unique, but "^FS" is not unique. There are occurances of "^FS" before and after "^FDExp:".
How do I get the string to search AFTER the occurrence, not before etc?
Is there an easy way to find a certain string within a string and then return the strings that you find as an array?I have written this:
Public Function FindStrings(ByVal strSourceString As String, ByVal strStartString As String, ByVal strEndString As String) As String() Dim StringStartposition As Integer Dim StringEndPosition As Integer Dim Currentposition As Integer = 1
I have this string called time. It's value is in this format: HH:MM:SS The numbers change, but the format stays the same. I want to separtate the code into 3 strings Hour, Minutes, Seconds.
This form works in VB .NET sendMsg = "<CStatus timestamp=""0"" " & _ "type=""login"" " & _ "cid = """ & cID & """ " & _ "key=""" & loginKey & """ />"
But I can't get it work in C# sendMsg = "<CStatus timestamp="0" type="login" cid="" + cID + "" key="" + loginKey + "" />";
It does not give the same effect. I want this as an output: <CStatus timestamp="0" type="login" cid="var_cid" key="var_key"/>; Is there any stringXml command in C# or another way to use double quotes in string? Solved it with XmlTextWriter
EG: i have 5 quotes listed 1 to 5, and i want some code to generate a number 1 to 5 and the label1.text = "chosen number"i cant for the life of me work it out, i think it was dblrnd
ive been working on a little program last days, it''s finished i can get it up and running it does all it has to do. the only thing im running to is that i want to write lines to a text file... which works.but in this text there are double quotes so i''m having this:
Dim folder As String folder = Form1.FolderBrowserDialog1.SelectedPath For Each foundDirectory As String In My.Computer.FileSystem.GetDirectories(folder + "\players\profiles\", FileIO.SearchOption.SearchTopLevelOnly, "*")