hi everyone I'm new to c# and working with file currently I need to read some string from the file but not the whole file so what functions can I use to read the file string by string ?

you can use:
1-Systrm.IO.StreamReader
or
2-Systrm.IO.TextReader

Ok I want to read a line and compare it with some string is there's any function that read a line from text file ?

System.IO.TextReader tr = new System.IO.StreamReader("c:\\myFile.txt");
if (tr.Peek() > -1)
{
    string line=tr.ReadLine();
}
tr.Close();

ok can you please explain your code ?

//Declare and init variable of text reader and specify the file full path
System.IO.TextReader tr = new System.IO.StreamReader("c:\\myFile.txt");
//check if file has data (not empty)
//Peek() get the next char and return -1 if EOF
if (tr.Peek() > -1)
{    
//Read Line
string line=tr.ReadLine();
}
//Close the file
tr.Close();

ok thanks a lot this code will read a single line at each iteration till the end of the file
??

and I have another question little bit far from my first question , I used to program in c++ and I recently move to c# but I have never programmed windows application , so if I declared any class does it have to be inherited from Form ??

there is no iterations here if so add while

no it has not unless you want to create a custom form

ok what about my other question can you help??

so this means that I can create any classes as in console applications and use them ,

yes but instead of using #include you will use the namespace direct no include needed

ok so I need to use forms for input and output and the rest is as in console applications ??

yes it is just like MFC and Dialoge ic c++