本文介绍了在C#中显示隐藏标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧我正在做这个表格,当我从下拉菜单中选择一个特定的项目时它会改变它的样子,
Alright I'm doing this form that's supposed to change it's look when I choose a specific item from a drop down menu,
private void ChangeGUI(int option)
{
switch (option)
{
case 0:
case 1:
labelAntal.Visible = true;
txtAntal.Visible = true;
labelWeight.Visible = false;
txtWeight.Visible = false;
break;
case 2:
labelAntal.Visible = false;
txtAntal.Visible = false;
labelWeight.Visible = true;
txtWeight.Visible = true;
break;
}
}
我一直在txtWeight.Visible上得到nullReferenceException ,那就是我从下拉菜单中选择第3个选项。
谁能看到我在这里做错了什么?:(
I keep getting a nullReferenceException on txtWeight.Visible , that is when i choose the 3'rd option from the drop down menu.
Can anyone see what I'm doing wrong here?:(
推荐答案
这篇关于在C#中显示隐藏标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!