private void btnDraw_Click(object sender, RoutedEventArgs e) { try { txtBox.Text = String.Empty; string Lines = txtboxNumber.Text; // From string to int numVal = Int32.Parse(Lines); if (numVal >= 15) { MessageBox.Show("Select 1-14 drawns."); } else { BLWindow window = new BLWindow(); txtBox.AppendText(window.drawGame(cmbGame.Text, numVal).ToString()); } } catch (Exception ex) { MessageBox.Show("Select number of drawns."); } }