Click here to Skip to main content
16,019,140 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code should, if the textbox is empty the pictureBox 1 will appear else will appear picturebox 2

What I have tried:

C#
if (tb5.Text == "")
{
    string myStringVariable1 = string.Empty;
    pictureBox1.Image == true(); // calling the picture

}
else
{
    pictureBox2.Image == true(); // calling the picture

}
Posted
Updated 22-Jul-17 5:36am

1 solution

Try:
C#
pictureBox1.Visible = false;
pictureBox2.Visible = false;
if (string.IsNullOrWhiteSpace(tb5.text))
   {
   pictureBox1.Visible = true;
   }
else
   {
   pictureBox2.Visible = true;
   }
 
Share this answer
 
Comments
Asyraf Patt 22-Jul-17 11:42am    
tq mate :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900