NewProg
NewProg

Reputation: 37

How To Know If the listbox is empty

sir how can i know if my listbox is empty or not?

i dont really have an idea for that. i'd try this but its wrong if listbox1.items = "" end if

thank you

Upvotes: 1

Views: 11881

Answers (1)

pg0xC
pg0xC

Reputation: 1266

There is a property ListBox.Items and you should try if Count is greater than 0 example:

If ListBox1.Items.Count > 0 Then
    YOURCODE
END IF

You should always use msdn library to check simple things like that. For example link to ListBox documentation is under https://msdn.microsoft.com/en-us/library/system.windows.forms.listbox(v=vs.110).aspx

Upvotes: 5

Related Questions