Sorry in VB.NET should be,
If Not IsNothing(droplist) Then
If droplist.SelectedItem.Text
' assign its value
End If
End If
Main Topics
Browse All TopicsI'm trying to check if one of my form controls has null value and have use
droplist.SelectedItem.text
droplist.SelectedItem.text
IsDBNull(dropList.Selected
but one of the above seem to work, can someone tell me how to check if it is null and assign it a value.
Brij
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Are you trying to check if one of the list item is null out of many ? Like, say you've populated a listbox from a dataset and you want to check if you've inserted a null value somewhere in the middle?
If that's the case.. try --
Dim iInteger as Integer
For iInteger = 0 to dropList.Items.Count - 1
if IsDbNull(dropList.Items.It
Next
You've gotta do the following
if not (droplist.selecteditem is nothing orlese droplist.selecteditem.text
messagebox.show droplist.selecteditem.text
else
if not droplist.selecteditem is nothing then
droplist.selecteditem.text
else
'''no entry was select
endif
end if
where at?
i just ran the below code (with fixing the type for ORELSE) w/o any error
If Not (droplist.selecteditem Is Nothing OrElse droplist.selecteditem.text
MessageBox.Show(droplist.s
Else
If Not droplist.selecteditem Is Nothing Then
droplist.selecteditem.text
Else
'''no entry was select
End If
End If
I think the DropDownList does not have any item. Then you should check like the following:
If droplist.Items.Count > 0 Then ' has member item
If Not IsNothing(droplist.Selecte
If droplist.SelectedItem.Text
' do something..
End If
End If
End If
The expression IsDBNull(dropList.Selected
Because text data type cannot have DBNull value.
Business Accounts
Answer for Membership
by: mondayblueboyPosted on 2003-09-16 at 13:51:05ID: 9373440
Not sure what you want,
droplist.SelectedItem Is Null, means none of DropDownList item is selected
droplist.SelectedItem.Text
Hope this info would helps