且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将组合框值设置为null

更新时间:2023-01-31 21:18:41

尝试首先检查组合框是否为空,请尝试此操作,

try to check first if the combobox is null, try this,

string itemSelected = combobox1.SelectedItem.ToString()

if(itemSelected ==null)
then
   itemSelected=string.empty

else

'do the adding



希望对您有帮助,

别忘了投票.



hope it helps,

don''t forget to vote..


如果组合框值为null,则尝试将空字符串添加到数据库中.
If combobox value is null then try to add empty string into the DataBase.
Dim S As String 
If ComboBox1.Text = "" Then
   S = ComboBox1.Text
Else
   S = ""
End If
ComboBox1.Text


并尝试将ComboBox的默认文本值"设置为",然后显示可见或不可见,如果未选择comboBox值,则返回"值.希望对您有所帮助.:)


And try to set Default Text Value of ComboBox is "" then Wether it is visible or invisible it returns "" value, if comboBox value is not selected.I hope it will help you.:)