I need to check for a string if it has bigger value then the one in text file .
My code is like this :
now it checks if it has zero value in the string, when it is 0 it reads from test.txt and sends it to the window. But I need is it has to check if it is 0 + if it is not 0 is it bigger value or not. If it is bigger then reads again from the test.txt .Code:String vl = Scores(); if (string.IsNullOrEmpty(vl) == true) { string text = System.IO.File.ReadAllText(@"test.txt"); textBox3.Text = text; VM = new VMessages("Wmedit//Edit"); VM.sendText(textBox3.Text); VM.sendKey(Keys.Enter); } else { System.IO.StreamWriter file = new System.IO.StreamWriter(@"test.txt"); file.WriteLine(vl); file.Close(); string text = System.IO.File.ReadAllText(@"test.txt"); textBox3.Text = text; VM = new VMessages("Wmedit//Edit"); VM.sendText(textBox3.Text); VM.sendKey(Keys.Enter); } }
How can I do this...
My string pharse code is like this:
thanks..Code:try { String source = File.ReadAllText(textBox1.Text + @"\result.txt"); source = source.Replace("\r", "").Replace("\n", ""); GroupCollection[ ] gr = (from Match it in Regex.Matches(source, @"\s*1\.\s+""([^""]*)"" Name![^-]*Value \(([^\)]+)\)[^-]*Distance \: ([0-9\.]+) meters\s*", RegexOptions.IgnoreCase) where it.Groups != null && it.Groups.Count == 4 select it.Groups).ToArray( ); if (gr == null || gr.Length == 0) { return null; } Double max = (from GroupCollection it in gr select Convert.ToDouble(it[2].Value)).Max( ); String res = (from GroupCollection it in gr where Convert.ToDouble(it[2].Value) == max select it[-1] + "Congratulation : " + it[1] + " :::...Score...::: " + it[2] + " ...:::Distance Meters...::: " + it[3]).First(); return res; } catch { throw; } finally { } }


Reply With Quote