Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
545
Ultracombo - SetInitialValue
posted

 

 

Can someone explain to me what's going on here...

I'm populating a grid based on a value selected in a stand alone UltraCombo.  When opening the form I would like to initialize the combo with the most common selection and thus populate the grid with data.

Performing SetInitialValue automatically calls the ValueChanged event - which is great.

If I designate my ultracombo to be of style "DropDown" the following code runs fine - meaning that, in the ValueChanged event, the value has a valid value.  However, if I simply change the style to "DropDownList" the ucChooseVendor.Value is null.

I had initially setup a bunch of forms with the style being DropDown (the default) but realized that the user could type text within the dropdown which I did not want - so I changed them to DropDownList style.

PS #1: Is there a way to have a DropDown style and yet prevent them from changing the list items (i.e., typeing) in the control?

PS #2: I also noticed that with the DropDown style, when I type bogus info into the combo the ucChooseVendor.Value is the value of the bogus data rather than say maybe null or -1.  In other words, why now all of a sudden, does the control want to return the DisplayMember vs the ValueMember?

All-in-all, somewhat confusing behavior in my opionion.

Thanks,

Mark

private void form1_Load(object sender, EventArgs e)

{

.....other code here....

ucChooseVendor.SetInitialValue(drv["VendorID"].ToString(), drv["Name"].ToString());

}

 

 

 

 

private void ucChooseVendor_ValueChanged(object sender, EventArgs

e)

{

....

 

 

 

 

 

DataTable dt = DataLayer.Vendors.GetGLAccountVendorItems(ucChooseVendor.Value.ToString()); // <= Value is Null here depending on style

....

 

 

 

 

)

Parents Reply Children
No Data