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
1187
Inherit UltraComboEditor for custom UserControl with fixed values
posted

We have several drop downs in our app with fixed values that get used repeatly in the application.  How can we create a custom user control that inherits from UltraComboEditor with a fixed value list?  We have tried a few things, most recently the code below.  With the code below, we end up the the value list repeatly appending and therefore the values show multiple times at runtime.  Is there a way to create a custom user control with a fixed value list?

 

Public Class ComboTaxFlag
    Public Sub New()
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Me.ValueList.ValueListItems.Clear()
        Me.ValueList.ValueListItems.Add(E_TAXFLAG.YES, "Yes")
        Me.ValueList.ValueListItems.Add(E_TAXFLAG.NO, "No")
        Me.ValueList.ValueListItems.Add(E_TAXFLAG.TAX1, "Tax 1")
        Me.ValueList.ValueListItems.Add(E_TAXFLAG.TAX2, "Tax 2")

        Me.Value = E_TAXFLAG.YES

    End Sub

End Class

 

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    You don't really need to derive a control. There are a bunch of ways you could do this much more easily.

    If you are using the latest version of the controls, then you can simply assign the ValueList property on each  UltraComboEditor control to the same ValueList.

    Or, you could create a data source, like UltraDataSource or maybe a List<T> or BindingList<T> and bind each UltraComboEditor to the same list.

     

Reply Children