如果组合框没有选择则文本框值为0
问题描述:
从月份到月份到月份的金额
textbox combobox1 combobox2 combobox3 combobox4
如果我还没有选择所有四个组合框然后文本框值自动显示0提交按钮
Amount From Month From Year To Month To year
textbox combobox1 combobox2 combobox3 combobox4
if i have not select all four combobox then textbox value show automatically 0 on submit button
答
在提交按钮单击事件中检查combox选择的索引或所选项目值或文本属性。如果所有4个值都没有任何值,则可以将文本框值视为零。
您要测试的字段取决于您如何绑定每个组合框,是否有任何默认值等。
检查以下文档
ComboBox.SelectedIndex Property [ ^ ]
ComboBox.SelectedItem属性 [ ^ ]
ListControl.SelectedValue Property [ ^ ]
ListControl.SelectedValue属性 [ ^ ]
in your submit button click event check the combox selected index or selected item value or Text properties. if all 4 values not having any value you can consider textbox value as zero.
the field you going to test is depend on how you binding each combo box, is there any default value etc..
check below documentations
ComboBox.SelectedIndex Property[^]
ComboBox.SelectedItem Property[^]
ListControl.SelectedValue Property[^]
ListControl.SelectedValue Property[^]