mardi 24 septembre 2019

Textbox not storing the information and others do if not null of empty

I'm trying to make that theirs a check if a textbox is empty, it wont pass the information on multiple textboxes on a button press, example:

 private void button1_Click(object sender, EventArgs e)
    {
        if (this.Controls.OfType<TextBox>().Any(t => string.IsNullOrWhiteSpace(t.Text)))
        {
             // what can i put here to exclude multiple
        }
        else
        {
            //if any of thouse are empty i dont want them to do this but if they are not empty i do want
            lablCinnamonset.Text = textBox1.Text; 
            lablMallardset.Text = textBox2.Text;
            lablAxisdeerSet.Text = textBox3.Text;
            lablBlackbuckSet.Text = textBox4.Text;
            lablMuledeerSet.Text = textBox5.Text;
            lablReddeerSet.Text = textBox6.Text;
            lablPumaSet.Text = textBox7.Text;
            lablWaterbuffaloSet.Text = textBox8.Text;
            lablJackrabbitSet.Text = textBox9.Text;
            lablCoyoteSet.Text = textBox10.Text;
            lablWhitetailSet.Text = textBox11.Text;
            lablBlacktailSet.Text = textBox12.Text;
            lablBlackbearSet.Text = textBox13.Text;
            lablRooseveltSet.Text = textBox14.Text;
            lablMooseSet.Text = textBox15.Text;
        }

Thank you guys

Aucun commentaire:

Enregistrer un commentaire