DateTime dateBefore = DateTime.Now - new TimeSpan(1,0,0, 0);
User Profile
Collapse
-
I don't know, what you want to do exactly, but you can subtract a day from now using -
You could use the following
Environment.Get FolderPath(Envi ronment.Special Folder.MyDocume nts);
(this returns a path-string)
There may be other useful paths in the SpecialFolder-enum.Leave a comment:
-
InvalidOperatio nException occurs when there are more or less than exactly one element in your collection. (e.g. when more users have the email-address "abi" or there's no user with this e-mail-address)
If you take FirstOrDefault( ) instead of Single(), it will return at least null if no element matches and returns you only the first element if more elements fit your Where()-clause.Leave a comment:
-
Is the content of wrote-variable after line 19 correct? (should be 512, the same as buffer.Length)
you could print the buffer using string.Join("," , buffer), comparing it with the results in your hex-editor (maybe the file's bytes are already changed ... just a thought)
you could also try to use a file on your local hard drive to see if their is a difference.Leave a comment:
-
Did you debug the working-method, if this method is called at all?
Can you provide some code?
Is the amount of running (well working) threads always the same or does it differ when you cloae your program and start it again?Leave a comment:
-
Why are you clearing the textsearch-field each run? Maybe that's the problem, because after the first run it's cleared and in the second run, you'll check if the directory-string contains an empty string (textsearch.Tex t is now string.Empty)Leave a comment:
-
I don't know, if it's possible using string.Split()-method, but maybe you could do it with string.ToCharAr ray().Leave a comment:
-
I've found something after a quick google search, but that's about Server 2008 R2. Hope it helps anyway.Leave a comment:
-
Using LinQ you could do it like
Code:int[] arr = XDocument.Load(@"C:\xxx.xml").Root.Elements("number").Select(element => int.Parse(element.Value)).ToArray();
Leave a comment:
-
You have to assign your labels to the list before you access them.
If you create them with the designer, you have to assign them by name, e.g. in method startCustom
Code:list[1] = label1; list[2] = label2; ...
Code:for(int i = 1; i < 5; i++) list[i] = new Label();
Leave a comment:
-
I'd also suggest to use for-each instead of for when iterating through a collection (list, array, dictionary, ...)
Code:private void timer1_Tick(object sender, EventArgs e) { foreach (Label label in list) // Loop through List with for-each { label.Location = new Point(label.Location.X, label.Location.Y - jump); if (label.Location.Y <= -20) { label.Location =
Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpI found out, that if the RichTextBox is big enough that no line is wrapped,
it works great.
Only if the richtextbox is smaller than some lines, wrong text gets colored ...Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpI don't know :-(
Can you post your file here, so I can try it?Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpThat's strange, I tried it with your code above and it worked correctly.
Maybe it's because of the file-size?
Try a test-file with just a few contents (e.g. 10 lines) and look if it works?
Did you set any parameters of richTextBox1 in the Designer?Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpYou've to use both lines. So uncomment the commented-out line.
Code://*** Coloring all the text inside the richTextBox1 in Red ***\\ string[] ftext = File.ReadAllLines(logger_reader); richTextBox1.Text = File.ReadAllText(logger_reader); for (int i = 0; i < ftext.Length; i++) ...
Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C Sharpftext is just a variable, which has nothing to do with my RichTextBox.
I just used it for having the lines.
So at least, I load the file twice, the first time into the RichTextBox, the second time into the ftext-array.Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpDo you fill the richTextBox?
I filled it up before by using
richTextBox1.Te xt = File.ReadAllTex t(@"C:\xxx.txt" );
Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpI tried a few things and figured out, that first the selection has to be done and after the selection you've to set the SelectionColor to color the selected text.
Also I didn't have used SelectedText but SelectionStart and SelectionLength , maybe it works also with SelectedText.
Code:for (int i = 0; i < ftext.Length; i++) { int start = richTextBox1.GetFirstCharIndexFromLine(i); richTextBox1.SelectionStart =
Leave a comment:
-
Christian Binder replied to How to color specific lines in richTextBox1 according to specific string word?in C SharpI think you only missed an if-statement within the for-loop.
e.g.
Code:for (int i = 0; i < ftext.Length; i++) { //check if line contains the word last (string item) if(ftext[i].Contains(item)) { //do the coloring as above } }
Leave a comment:
No activity results to display
Show More
Leave a comment: