borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Delete problem! (Urgent))Next Topic (how can i send file with ftp?) New Topic New Poll Post Reply
AndreaVB Forum : VB General : How Do I Change The Number of Items Shown in a Drop Down at Runtime
Poster Message
matt_1ca
Level: Scholar

Registered: 27-03-2005
Posts: 42

icon How Do I Change The Number of Items Shown in a Drop Down at Runtime

Can the number of comboitems in an imagecombo shown at anytime from the list portion of the said imagecombo dropdown  be set?

It is something am finding really strange right now that the number of rows cannot seem to be set for an imagecombo, I tried my best to look at all properties both design time and run-time properties and cannot seem to find a way how to do it..

There seem to be a way (though I am not sure) using the MaxDropDownItems property but such a property seem to be exposed only in .NET and I do not intend to to migrate to .NET just for this -- right now I am trying to dig for information if there is really no way -- man, its unbelievable!

Looking back in retrospect, correct me if I am wrong but I think even the ordinary combobox does not have such ability. For years I havent noticed it and its surprising that there is for example an LB_SETCOUNT but no equivalent CB_SETCOUNT. There is however a CB_GETCOUNT equivalent to the LB_GETCOUNT but this wont help in adjusting the number of items shown in the drop down.

All suggestions welcome and thank you so much for all the kind help you can give

Matt

10-10-2006 at 06:46 PM
View Profile Send Email to User Show All Posts | Quote Reply
matt_1ca
Level: Scholar

Registered: 27-03-2005
Posts: 42
icon Re: How Do I Change The Number of Items Shown in a Drop Down at Runtime

My dim statements look something like this:

Dim lstimg as ListImage, intCnt as integer
Dim strTextOnCombo as string, strKeyForImage
Dim cboItData as ComboItem
Dim strPathToMyBMPfile as string, i as integer

I add an image into my imagelist (my image list control's name is imglstLayer) control
from there associate the imagelist with the added image to my  imageCombo (imgCbo)
then add the combo item itself -- something like:

for i = 1 to intCnt
   set lstimg = imglstLayer.ListImages.Add(strKeyForImage & cstr(intCnt),LoadPicture(strPathToMyBMPfile))
   with imgCbo
      .imageList = imglstLayer
      set cboitData = .ComboItems.Add(intCnt,, strTextOnCombo, strKeyForImage & cstr(intCnt))
   end with      
next i

I did some additional experiments and concluded that for ordinary comboboxes the total number of rows default to 8 whereas for image combo it defaults to 9.  

The listcount property of the ordinary combobox wont be of great help because it is read only and even it it were not still it wont be able to totally help as what it is giving is the number of items total for the dropdown and not the number of items I want to be visible per "page" of the drop down list.

For example if I had twenty comboitems and want to display 10 items at a time, doing a
combo.listcount yields 20 which thus cannot be used to directly tell the computer that I want 10 items per page.

Moreover the imagecombo does not seem to have a listcount property, so listcount property is definitely ruled out.

The only reason I cannot accept as impossible what I am trying to do is because I have seen some applications do it. For example in the layer toolbar of AutoCAD you will see that they were able to stretch the size of an imagecombo so that it has at least 25 rows in it  as opposed to the default of 9.

Thank you so much for all the kind help you can give.

Gratefully,
Matt

11-10-2006 at 11:36 AM
View Profile Send Email to User Show All Posts | Quote Reply
matt_1ca
Level: Scholar

Registered: 27-03-2005
Posts: 42
icon Re: How Do I Change The Number of Items Shown in a Drop Down at Runtime

yet another experiment, when I change the style for example of a simple combobox at design time then I can control the
number of rows displayed but there are two issues with it:

1. I loose the drop down capability in fact the the down arrow is gone
2. the list portion cannot extend beyond the boundaries of the form, unlike the case when the combobox style is
    DropDown Combo (this is severe limitation as a very big form size just to accomodate the list portion of the drop  
    down would cover too much of the screen) and hence rejected by the users

This being the case despite the fact that the number of comboitems can be controlled for a simple combobox at design time -- it is still not the solution.

I will keep on digging.

Matt

11-10-2006 at 02:29 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : How Do I Change The Number of Items Shown in a Drop Down at Runtime
Previous Topic (Delete problem! (Urgent))Next Topic (how can i send file with ftp?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder