private void textBox_AlbumName_Leave(object sender, EventArgs e) { try { if (textBox_AlbumName.Text.Length > 0 && textBox_AlbumName.Text.Length < 100) { theSong.AlbumName = textBox_AlbumName.Text; Error3.SetError(textBox_AlbumName, ""); } else { throw new System.ArgumentException(); } } catch { Error3.SetError(textBox_AlbumName, "Album Name is required and must be less than 100 Characters..."); } }
private void textBox_AlbumName_Leave(object sender, EventArgs e) { try { if (String.IsNullOrWhiteSpace(textBox_AlbumName.Text)) { Error3.SetError(textBox_AlbumName, "This is required..."); } else { theSong.AlbumName = textBox_AlbumName.Text; Error3.SetError(textBox_AlbumName, ""); } } catch (FormatException) { Error3.SetError(textBox_AlbumName, "Invalid Format!"); } catch (Exception Ex) { Error3.SetError(textBox_AlbumName, Ex.Message); } }