how to compare eachline in a richtextbox with an hashtable? if match write in a text file
plz help...........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
vishnu krishnanPosted Sep 30, 2010, 3:52 PM
vishnu krishnanPosted Sep 30, 2010, 3:33 PM
Felipe RamosPosted Sep 30, 2010, 2:40 PM
vishnu krishnanPosted Sep 30, 2010, 2:34 PM
i have another simple problem, i expect ur idea.plz.....
here i am loading a program into richtext box
but in the richtextbox contain, white space between lines, so how will remove this ..
example
#include
int main()
{
(space)int a,b;
}
i want to remove i show in above code(space) not space between int and main.
Felipe RamosPosted Sep 30, 2010, 2:02 PM
vishnu krishnanPosted Sep 30, 2010, 1:19 PM
plz chk this.............................
private void CreateArray()
{
Hashtable hash = new Hashtable();
hash.Add("1", "int");
hash.Add("2", "float");
using (System.IO.StringReader reader = new System.IO.StringReader(richTextBox1.Text))
{
while (reader.Peek() > 0)
{
string line = reader.ReadLine();
if (hash.ContainsValue(line))
{
MessageBox.Show(line);
}
}
}
}
can u change write to a file with messagebox....
if u get plz let me knw ........
Felipe RamosPosted Sep 30, 2010, 12:46 PM
vishnu krishnanPosted Sep 30, 2010, 11:22 AM
vishnu krishnanPosted Sep 30, 2010, 11:16 AM
this nothing write into the file...
StreamWriter writer = new StreamWriter("D:\\help.txt", true);
using (System.IO.StringReader reader = new System.IO.StringReader(richTextBox1.Text))
{
while (reader.Peek() > 0)
{
string line = reader.ReadLine();
if (hash.ContainsValue(line))
{
writer.WriteLine(line);
}
}
}
}
Felipe RamosPosted Sep 30, 2010, 10:55 AM
vishnu krishnanPosted Sep 30, 2010, 10:37 AM
help?
Felipe RamosPosted Sep 30, 2010, 8:42 AM
vishnu krishnanPosted Sep 29, 2010, 11:40 PM
Felipe RamosPosted Sep 28, 2010, 10:11 AM