I tried using String.Format that is commented below but it doesn't work. I tried using contains but it seems like it only takes a certain amount of characters its not reading 2 numbers just 1. I want it to really use the string.format. I pretty much want to save the two numbers from the textbox and display them and in that format only.
What do i need to do?
string s = textBox1.ToString();
string text = textBox1.Text;
text = text.Trim().ToLower();
MatchCollection matches = Regex.Matches(s, @"d+");
string[] result = matches.Cast<Match>()
.Take(2)
.Select(match => match.Value)
.ToArray();
//string c = string.Format("The alarm id from video server number {0} is {1}.", result[0], result[1]);
if (s.Contains("The alarm id from video server"))
{
if (matches.Count == 2)
{
AlarmID.Text = result[0];
ServerNum.Text = result[1];
}
else
{
MessageBox.Show("Missing number(s) or too many!");
}
}
