PDA

View Full Version : Max values in a listbox?



lienlee
06-04-2010, 08:39 AM
Is there a way to set the number of rows you can have into a list box? So that only 2 values can be added.

ps. if not. my code keeps duplicating the values. what kind of if statement can i use with
ListBox1.AddItem "Sentence"
so that it will only print out when "sentence" isnt in the listbox

Ive tried doing if .value = "" and then .additem. but the output is blank.

Thanks.

OBP
06-04-2010, 09:31 AM
I am not sure why you are allowing a User to edit the List rows, you could get the count of items in the list and if they exceed 2 then remove any extra lines using the ".ListCount - 1"