How to make a ComboBox accept only list values

Thank you all.


Based on replies from this forum and another user forum I put this together:


Open the form in Developer mode.

Go to Wizards

Form Event Wizard

Select Event Type – Load

Click Right Arrow to move Handler to right side.

Enter this in Code:  cboReasonCode.DropDownStyle =
Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;

Click Update All Event Codes

Save and Exit


[Where cboReasonCode is the name of the combo box]


Anyone know how to force the combobox to accept only values from the list?  The combo box is working fine and I tried a retrievercombobox based on a UD Table with the same results.  It allows for items to be typed in freeform as well as selected from the list.  I need to prevent the freeform entries.  I only want items from the list or a blank value.  I believe I need to set DropDownStyle = DropDownList but I am not sure how to accomplish that.

 

Is there something similar to preprocessing in a BPM that can set this flag in a customization on the screen?  A load event or something?

 

For what it’s worth, I think this should be the default and you should have to change it if you want to allow freeform responses.

 

Thanks in advance,

 

Doug Oswald

Director of Information Technology

Fleetwood

www.fleetwoodfixtures.com

Extraordinary custom fixtures for the life of your brand!

Corporate Office

225 Peach Street Leesport Pennsylvania 19533

USA - Illinois • New York • Pennsylvania

P. 610 916 9999    F. 610 916 9900    C. 610 406 8200

International - China

Green Plus Certified • We Reclaim, Recycle and Respect the Environment

 

DropDownStyle is correct you have to do it on Load of the form in the script area.

 

Joshua Giese
Technology Solutions : CTO

Direct Phone:    920.593.8299
Office Phone:    920.437.6400 x342

http://wcibags.com/email/emailFooter4.jpg

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 26, 2016 9:56 AM
Subject: [Vantage] How to make a ComboBox accept only list values

 

 

Anyone know how to force the combobox to accept only values from the list?  The combo box is working fine and I tried a retrievercombobox based on a UD Table with the same results.  It allows for items to be typed in freeform as well as selected from the list.  I need to prevent the freeform entries.  I only want items from the list or a blank value.  I believe I need to set DropDownStyle = DropDownList but I am not sure how to accomplish that.

 

Is there something similar to preprocessing in a BPM that can set this flag in a customization on the screen?  A load event or something?

 

For what it’s worth, I think this should be the default and you should have to change it if you want to allow freeform responses.

 

Thanks in advance,

 

Doug Oswald

Director of Information Technology

Fleetwood

www.fleetwoodfixtures.com

Extraordinary custom fixtures for the life of your brand!

Corporate Office

225 Peach Street Leesport Pennsylvania 19533

USA - Illinois • New York • Pennsylvania

P. 610 916 9999    F. 610 916 9900    C. 610 406 8200

International - China

Green Plus Certified • We Reclaim, Recycle and Respect the Environment

 

Joshua,

I have not done something like this before.  Can you provide a little more guidance?

Are talking about the Script Editor in the Customization?

Should it look something like this?

Private Sub PartForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles PartForm.Load

Dim DropDownList as Integer = 1

        Dim DropDown as Integer = 0

             ucbEpiCustom1.DropDownStyle = DropDownList

 End Sub



Something to that effect yes. You have the right _Load method. I’m not sure the exact syntax in VB but if you google it you will find what you are looking for. That DropDownList as Integer is not what you want. It’s an enumerated list that you will want to use instead.

 

Joshua Giese
Technology Solutions : CTO

Direct Phone:    920.593.8299
Office Phone:    920.437.6400 x342

http://wcibags.com/email/emailFooter4.jpg

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 26, 2016 11:01 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: How to make a ComboBox accept only list values

 

 

Joshua,

 

I have not done something like this before.  Can you provide a little more guidance?

 

Are talking about the Script Editor in the Customization?

 

Should it look something like this?

 

Private Sub PartForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles PartForm.Load

Dim DropDownList as Integer = 1

        Dim DropDown as Integer = 0

             ucbEpiCustom1.DropDownStyle = DropDownList

 End Sub

 

 

You can use the LimitToList property of the UltraCombo...
ucCombo.LimitToList = true;
This will prevent you from leaving the field if the value isn't  a valid value on the list.

Alternatively you can use the item not in list eventÂ
// ItemNotInList event
     private void ultraCombo1_ItemNotInList(object sender, Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs e)
     {
         
         e.RetainFocus = true;

         e.Beep = true;
     <span style="color:rgb(0,128,0);">// Display a message box indicating that the entered text is invalid.

MessageBox.Show( e.InvalidText + " is not a valid value.", "Invalid Entry" );

     <span style="color:rgb(0,128,0);">// Restore a previously valid value if one was entered, otherwise set a valid default value.

if ( e.LastValidValue != null )
this.ultraCombo1.Value = e.LastValidValue;
else
this.ultraCombo1.SelectedRow = this.ultraCombo1.Rows[0];
}



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet
ipsos custodes?


On Tue, Jan 26, 2016 at 12:21 PM, Joshua Giese jgiese@… [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>

Something to that effect yes. You have the right _Load method. I’m not sure the exact syntax in VB but if you google it you will find what you are looking for. That DropDownList as Integer is not what you want. It’s an enumerated list that you will want to use instead.

Â

Joshua Giese
Technology Solutions : CTO

Direct Phone:Â Â Â 920.593.8299
Office Phone:Â Â Â 920.437.6400 x342

http://wcibags.com/email/emailFooter4.jpg

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 26, 2016 11:01 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: How to make a ComboBox accept only list values

Â

Â

Joshua,

Â

I have not done something like this before. Can you provide a little more guidance?

Â

Are talking about the Script Editor in the Customization?

Â

Should it look something like this?

Â

Private Sub PartForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles PartForm.Load

Dim DropDownList as Integer = 1

       Dim DropDown as Integer = 0

       ucbEpiCustom1.DropDownStyle = DropDownList

 End Sub

Â

Â

</div>
 


<div style="color:#fff;min-height:0;"></div>

Interesting Jose, learn something new everyday.

Doug, here is how to set the DropDownStyle property if you're curious.

cbo.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;


From: "Jose Gomez jose@... [vantage]" <vantage@yahoogroups.com>
To: Vantage <vantage@yahoogroups.com>
Sent: Tuesday, January 26, 2016 12:51 PM
Subject: Re: [Vantage] RE: How to make a ComboBox accept only list values

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394 --

#ygrps-yiv-1882424340yiv0729528394 .ygrps-yiv-1882424340yiv0729528394ygrp-photo-title{
clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394ygrp-photo{
background-position:center;background-repeat:no-repeat;background-color:white;border:1px solid black;height:62px;width:62px;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394photo-title
a,
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394photo-title a:active,
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394photo-title a:hover,
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394photo-title a:visited {
text-decoration:none;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394attach-table div.ygrps-yiv-1882424340yiv0729528394attach-row {
clear:both;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394attach-table div.ygrps-yiv-1882424340yiv0729528394attach-row div {
float:left;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 p {
clear:both;padding:15px 0 3px 0;overflow:hidden;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394ygrp-file {
width:30px;}
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394attach-table div.ygrps-yiv-1882424340yiv0729528394attach-row div div a {
text-decoration:none;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394attach-table div.ygrps-yiv-1882424340yiv0729528394attach-row div div span {
font-weight:normal;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 div.ygrps-yiv-1882424340yiv0729528394ygrp-file-title {
font-weight:bold;}
#ygrps-yiv-1882424340
#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394
#ygrps-yiv-1882424340yiv0729528394ygrp-mkp {
border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp hr {
border:1px solid #d8d8d8;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp #ygrps-yiv-1882424340yiv0729528394hd {
color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp #ygrps-yiv-1882424340yiv0729528394ads {
margin-bottom:10px;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp .ygrps-yiv-1882424340yiv0729528394ad {
padding:0 0;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp .ygrps-yiv-1882424340yiv0729528394ad p {
margin:0;}

#ygrps-yiv-1882424340 #ygrps-yiv-1882424340yiv0729528394 #ygrps-yiv-1882424340yiv0729528394ygrp-mkp .ygrps-yiv-1882424340yiv0729528394ad a {
color:#0000ff;text-decoration:none;}
#ygrps-yiv-1882424340



You can use the LimitToList property of the UltraCombo...
ucCombo.LimitToList = true;
This will prevent you from leaving the field if the value isn't  a valid value on the list.

Alternatively you can use the item not in list event 
// ItemNotInList event
     private void ultraCombo1_ItemNotInList(object sender, Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs e)
     {
         
         e.RetainFocus = true;

         e.Beep = true;
     <span id="ygrps-yiv-1882424340yui_3_16_0_1_1453822932084_20717" style="color:rgb(0,128,0);">// Display a message box indicating that the entered text is invalid.

MessageBox.Show( e.InvalidText + " is not a valid value.", "Invalid Entry" );

     <span id="ygrps-yiv-1882424340yui_3_16_0_1_1453822932084_20733" style="color:rgb(0,128,0);">// Restore a previously valid value if one was entered, otherwise set a valid default value.

if ( e.LastValidValue != null )
this.ultraCombo1.Value = e.LastValidValue;
else
this.ultraCombo1.SelectedRow = this.ultraCombo1.Rows[0];
}



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet
ipsos custodes?


On Tue, Jan 26, 2016 at 12:21 PM, Joshua Giese jgiese@... [vantage] <vantage@yahoogroups.com> wrote:

 
<div id="ygrps-yiv-1882424340yui_3_16_0_1_1453822932084_20750">
  
  
  <div>
Something to that effect yes. You have the right _Load method. I’m not sure the exact syntax in VB but if you google it you will find what you are looking for. That DropDownList as Integer is not what you want. It’s an enumerated list that you will want to use instead.
 
Joshua Giese
Technology Solutions : CTO
Direct Phone:    920.593.8299
Office Phone:    920.437.6400 x342
http://wcibags.com/email/emailFooter4.jpg
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Tuesday, January 26, 2016 11:01 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: How to make a ComboBox accept only list values
 
 
Joshua,
 
I have not done something like this before.  Can you provide a little more guidance?
 
Are talking about the Script Editor in the Customization?
 
Should it look something like this?
 
Private Sub PartForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles PartForm.Load
Dim DropDownList as Integer = 1
        Dim DropDown as Integer = 0
             ucbEpiCustom1.DropDownStyle = DropDownList
 End Sub
 
 
</div>
 


<div style="color:#fff;min-height:0;"></div>