Hello all,
I am trying to set up a "tip of the day" feature for one of our sites which reads the term from a text file, I am relatively new to C# so I am kind of struggling a little.
Here is the call from the body of the page
Any help is much appreciated
I am trying to set up a "tip of the day" feature for one of our sites which reads the term from a text file, I am relatively new to C# so I am kind of struggling a little.
Code:
public class textFromFile
{
private const string FILE_NAME = "termOfTheDay.txt";
public static void Main(String[] args)
{
if (!File.Exists(FILE_NAME))
{
("{0} does not exist.", FILE_NAME);
return;
}
StreamReader todaysTerm = File.OpenText(FILE_NAME);
String input;
while ((input=todaysTerm.ReadLine())!=null)
{
(input);
}
("The end of the stream has been reached.");
todaysTerm.Close();
}
}
Here is the call from the body of the page
Code:
<%=todaysTerm%>
Any help is much appreciated