Исключение при выполнении кода "Object reference not set to an instance of an object" - C#
Формулировка задачи:
Как исправить данный код ? Вроде всё правильно сделала.
Выдаёт ошибку:
Object reference not set to an instance of an object.
string[] array_string = new string[5];
byte b_b = 0;
private void button14_Click(object sender, EventArgs e)
{
try
{
string str = textBox19.Text;
array_string[0 + b_b] = str;
b_b++;
label26.Text = b_b.ToString();
textBox19.Text = "";
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
private void button13_Click(object sender, EventArgs e)
{
try
{
Array.Sort<string>(array_string);
foreach (string s in array_string)
{
textBox17.AppendText(s.ToString() + "; ");
textBox17.Text += Environment.NewLine;
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}Решение задачи: «Исключение при выполнении кода "Object reference not set to an instance of an object"»
textual
Листинг программы
s.ToString()