Skip to content

UltraCombo start with empty value

New Discussion
Maciej Pietruszka
Maciej Pietruszka asked on Mar 9, 2020 3:55 PM

When app runs combo takes as initial value 1st  item on list (Im binding datatatble)

Is there any option to leave it blank – so user need to select ?

(still I do need Limit to list functionality)

Sign In to post a reply

Replies

  • 0
    Teodosia Hristodorova
    Teodosia Hristodorova answered on Mar 9, 2020 12:59 PM
    Hello,
    I have created a small sample trying to reproduce the described behavior. On my side, everything works and expected and when the UltraCombo is loaded at first there is no value in it. In order to select it, you have to click on the drop-down button and select the desired row. As you can see in the attached sample below, I'm binding to DataTable.
    Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.
    Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
    Thank you for your cooperation.
    Looking forward to hearing from you.
    Sincerely,
    Teodosia Hristodorova
    Associate Software Developer
  • 0
    Mike Saltzman
    Mike Saltzman answered on Mar 9, 2020 1:10 PM

    The UltraCombo does not automatically select a value, so something in your code must be setting a value initially. 

    My guess is that you are doing this without realizing it. Perhaps you are binding the Value or Text property, in addition to binding the list. 

    • 0
      Maciej Pietruszka
      Maciej Pietruszka answered on Mar 9, 2020 2:18 PM

      Im not binding this control

      Only thing Im doing is setting:
      dataSource = dTable
      DisplayMember and ValueMember

      Can this be because of *Member assignements ?

      • 0
        Mike Saltzman
        Mike Saltzman answered on Mar 9, 2020 2:30 PM

        No, to bind the Value or Text property, you would have to be using Bindiings.Add in code or maybe at design-time. 
        You might also want to check to see if you are setting SyncWithCurrencyManager to true. That might cause the combo to "select" the current item in the data source. 

        Other than that, your code would have to be setting the Value or Text property directly. I can't think of any other way the value could be getting set. 

        Why don't you try putting a breakpoint in the ValueChange and/or TextChange events of the combo and see if it's getting hit, and if so, look at the call stack to see where the set it occurring? 

      • 0
        Maciej Pietruszka
        Maciej Pietruszka answered on Mar 9, 2020 3:00 PM

        Thanks Mike!

        SyncWithCurrencyManager=true

        Did that !

        Dont know how it was changed because I didnt touch it.

      • 0
        Mike Saltzman
        Mike Saltzman answered on Mar 9, 2020 3:55 PM

        So… what that property does is it keeps the Combo in synch with the current position of the CurrencyManager/BindingManager for the list. 

        So that means if you select an item from the list and you have some other controls bound to the same data source, they will all update to that position. You typically use that when your combo is being using for navigation – so the user selects a row and then you have a bunch of textboxes and other controls on the form and you want them all to show the data from that row. 

        If you are not using the UltraCombo to navigate your data, then setting SyncWithCurrencyManager to false (or simply NOT setting it to true, since false is the default) is the correct solution. 

        If you ARE using the UltraCombo for navigation, then the initial behavior you were seeing is correct, because the CurrencyManager is positioning itself to the first row when you bind and I don't think there's any way around that. Although I suppose you could try getting the CurrencyManager and setting it's position to -1 or something. Not sure if they allow that. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Maciej Pietruszka
Favorites
0
Replies
6
Created On
Mar 09, 2020
Last Post
6 years, 7 months ago

Suggested Discussions

Tags

Created by

Created on

Mar 9, 2020 3:55 PM

Last activity on

Mar 9, 2020 3:55 PM