Esempio n. 1
0
 private void btnAddSong_Click(object sender, EventArgs e)
 {
     if (txtSong.Text == null || txtSong.Text.Equals(""))
     {
         ErrorSong.SetError(txtSong, "Song's name must not be empty!");
         return;
     }
     else
     {
         ErrorSong.Clear();
         listSongs.Items.Add("- " + txtSong.Text);
         txtSong.Clear();
         txtSong.Focus();
     }
 }
Esempio n. 2
0
        public bool valid()
        {
            bool isError = false;

            if (txtID.Text.Equals(""))
            {
                ErrorID.SetError(txtID, "ID must not be empty!");
                isError = true;
            }

            if (txtAlbum.Text.Equals(""))
            {
                ErrorAlbum.SetError(txtAlbum, "Album must not be empty!");
                isError = true;
            }
            if (txtSinger.Text.Equals(""))
            {
                ErrorSinger.SetError(txtSinger, "Singer must not be empty!");
                isError = true;
            }
            if (listSongs.Items.Count == 0)
            {
                ErrorSong.SetError(listSongs, "You must add at least one song");
                isError = true;
            }


            if (isError)
            {
                return(false);
            }
            else
            {
                ErrorID.Clear(); ErrorAlbum.Clear(); ErrorDuration.Clear();
                ErrorSinger.Clear(); ErrorSong.Clear();
                return(true);
            }
        }//end of valid()