C#winform:if else for picturebox [英] C# winform: if else for picturebox
本文介绍了C#winform:if else for picturebox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码应该,如果文本框为空,则pictureBox 1将出现,否则将出现picturebox 2
我尝试过:
My code should, if the textbox is empty the pictureBox 1 will appear else will appear picturebox 2
What I have tried:
if (tb5.Text == "")
{
string myStringVariable1 = string.Empty;
pictureBox1.Image == true(); // calling the picture
}
else
{
pictureBox2.Image == true(); // calling the picture
}
推荐答案
尝试:
Try:
pictureBox1.Visible = false;
pictureBox2.Visible = false;
if (string.IsNullOrWhiteSpace(tb5.text))
{
pictureBox1.Visible = true;
}
else
{
pictureBox2.Visible = true;
}
这篇关于C#winform:if else for picturebox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文