Results 1 to 4 of 4

Thread: Combo Box

  1. #1
    Join Date
    Jul 2004
    Posts
    56

    Unanswered: Combo Box

    Hi,

    I have a combo box that has 4 columns, and is bound by Column 1 which is the unique number. I have this cou,n hidden using 0;2;2 etc,etc. Once the user selects the row from the combo box that they wish to enter the box only shows column 2 and not columns three and four. Can I make the combo box show all the colums I want it to?

    Thank


    Col_bol

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Sure...You can progmaticly change the ComboBox ColumnWidths, ColumnCount, and ListWidth properties to make your ComboBox control to display whatever you like. You just have to remember to do everything in twips instead of inches or cm (1" = 1440 twips). You can however use inches or cm's for the ColumnWidths property but it must be done in this fashion:

    Me.myComboBoxControlName.ColumnWidths = "1.5 in; 0 in; 1 in"

    OR

    Me.myComboBoxControlName.ColumnWidths = "2 cm; 1 cm; 0 cm"

    If you want a column to display enter any size greater than zero. If you dont want a specific column to display then make sure the size is set to zero (0). In the first ColumnWidths sample, the 2nd column will not be displayed within the ComboBox. In the second ColumnWidths sample, the 3rd column will not be displayed within the ComboBox.

    If you want to progmaticly set the ListWidth then it must be set by way of Twips. For example: If we want to set our ComboBox ListWidth to 3", we would have a code line as follows:

    Me.myComboBoxControlName.ListWidth = 3 * 1440

    The ColumnCount property simply required a Integer number value.

    Between these three properties, and a Query or SQL combination, you can make your ComboBox display whatever you like, whichever way you like to.


  3. #3
    Join Date
    Jul 2004
    Posts
    56

    Thanks - another question though

    Thanks CyberLynx.

    Two questions really.

    1. I take it changing this in the properties of the combo box doesn't have the same effect?

    2. Where do I add the code to, the form or the box and if the box where?

    Thanks

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487

    Smile

    Quote Originally Posted by col_bol
    Thanks CyberLynx.
    Two questions really.

    1. I take it changing this in the properties of the combo box doesn't have the same effect?

    2. Where do I add the code to, the form or the box and if the box where?
    Thanks
    __________________________________________________ ________________________

    1) You can modify the ComboBox properties in both Design time and progmaticly in Run time. Both will produce the same results. When changing the properties in design time, enter all parameters in either inches or cm's.There is no need to worry about twips in Design mode since the coversion.is automatically done once placed into Run mode.

    2) If you want to actually change a ComboBox properties progmaticly, when and where to initiate the code is entirely up to you. Perhaps if a button is selected, or during an event from another control. Only you can decide this at this point since very little information has been provided about your specific application.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •