private void createBtn_Click(object sender, RoutedEventArgs e) { try { int widthC = Convert.ToInt32(WTB.Text); int heightC = Convert.ToInt32(HTB.Text); DrawGreed.CreateGrid(widthC, heightC, canvas); created = true; createBtn.IsEnabled = false; } catch (Exception) { } }