I created the textbox with InputScope="Number" Name="site". Whenever the user enters the number in between 1 to 454. It will show the entered number's html file.
For example if user enters 3, it will open def/f3.html. Here' is my problem if user enters 003, it will search for def/f003.html Since I dont have that file, it breaks.
help me to avoid 0's before number
My C# Code:
private void search(object sender, RoutedEventArgs e)
{
int num = 0;
if (int.TryParse(number.Text, out num) && num > 0 && num < 455)
{
string site;
site = number.Text;
var rs = Application.GetResourceStream(new Uri("def/f" + site + ".html", UriKind.Relative));
StreamReader sr = new StreamReader(rs.Stream);
browser.NavigateToString(sr.ReadToEnd());
}
else
{
MessageBox.Show("Enter Value between 1 to 454");
}
}