Answer is located here
http://social.msdn.microsoft.com/For...1-9ca461a1e252...
User Profile
Collapse
-
How do I change the displayed text color of individual list box items?
Hi I have a listbox that I am adding files to it. If the user checks a specific radiobutton when adding the item, I want to color the text with some color -- but only the text for that item, not all the items. The problem I am having is that my code colors all the items the same. Anyone know a simple way to do this?
The objects the user is adding to the listbox are files
and I want to display the Name of the file in the listbox,... -
I changed my regular expression to this and it worked
^XXX.*\r\n(.*\r \n)+(?=^XXX)
However sometimes when the match contains multiple XXX sections, it matches all the way to the last one and then my match includes multiple sections. I only want it to match one, any suggestions?Leave a comment:
-
How to exclude part of a string from a regular expression match?
If I have a string as follows
XXXasdf23s5\r\n
asdflkoirfn329i 4\r\n
sef29384ewrj280 39\r\n
XXX123sd3t334\r \n
sdorfu23984rr\r \n
sdflk2893rjf\r\ n
weirj2983jhwer2 398\r\n
XXX12356789\r\n
4w3ujr523q938er \r\n
basically I am searching for sections that begin with XXX but I don't know what the end will be. All I know is that the next section will definitely start with 'XXX'... -
-
I think I know the problem, although your code works, in this case we are guaranteed that the array will be instantiated with the Split results. So it will never be null.
In my code the location where I populate each object array is nested inside other code. I have thousands of objects and some of them are null and don't get initialized.
I'm running another test but does the foreach loop take into account a null...Leave a comment:
-
Sorry you can ignore that other code I posted
I mixed up the order in which I was doing this, I populate the array first by assigning the Split result to the array, basically copies the array into my variable. Then later on I do some searching text replacing/modification on the array elements depending on some conditions. (checking if its null first of course)Code:object.array[0] = "something";
...Leave a comment:
-
Yes I'm only using the word object as a name here, its called something else in my program. I don't give my arrays a length at the beginning (i.e. when I instantiate the variable inside the object class) because each object will have a different array size.
...Code:[B]private string [] Array = null;[/B] [B]public string [] array { get { return this.Array; } set { this.Array = value; } }[/B]Leave a comment:
-
How to access Array elements in an object that is in a List?
Hi,
I have an object, and inside are different variables that I populate during runtime, one of the is an array of string
So I populate it like thisCode:[B]string [] array = null;[/B]
Then I have a List of these objects like this and add my objects to it, perform stuff on the list like sorting and search etc.Code:[B]object.array[0] = "something";[/B]
...Code:[B]List<object>[/]
-
Oralloy thanks, this gives me the same result as my modification in post #3 with the change I made in post #5. Both results are the same negative number (-738)
From MSDN "the Return Value is: The zero-based index of item in the sorted List<T>, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise...Leave a comment:
-
Update:
I made some progress, I changed from an ArrayList to a List<> because I wanted access to each object in the list, in case i wanted to change a value, and now it works better.
...Code:List<reportValues> test2 = new List<reportValues>(); //code to fill List<> and then sort it goes here values key = new values(); key.id = "whatever"; int
Leave a comment:
-
I'm not asking for anyone to write my code. I need help because I can't locate the information i need to complete my code.
Sorry for not including more detail in my first post, i was in a rush :)
I already sorted my ArrayList, here is the code that does it
...Code://CLASS public class sortAscendingHelper : System.Collections.IComparer { public int Compare(object x, object y)Leave a comment:
-
Help! BinarySearch on an ArrayList of objects
Hi, I have a sorted (alphanumeric) ArrayList of class objects as follows.
...Code:public class reports { public System.Collections.ArrayList rptCollection = new System.Collections.ArrayList(); public reports() { } } public class values { private string ID= string.Empty; private -
actually I found something that works
I used Regex.Escape(pa ttern) to treat the * as a regular character. I pass that instead of pattern itself in the replace function.Leave a comment:
-
How do I pass * characters in System.Text.RegularExpressions.Regex.Replace
I am using System.Text.Reg ularExpressions .Regex.Replace( input, pattern, replacement, options) in c# to replace the input string. The pattern I am using may have one or more * or . or any other character basically inside mixed in with the rest of the string. I want to find this string in the input and replace it with something.
For example say my string is *000000000
I get the following error
System.Argument Exception:...
No activity results to display
Show More
Leave a comment: