on 2006 Apr 06 5:08 PM
Hey All,
Can anyone tell me how I can clear the selected value from a combo box that is linked to a field on my UDO? even when the combo box has no valid values the previously selected value remains.
Thanks
Hi,
I'm using 2004C and I'm fighting with the same problem:
I have a user form created from a UDO using cot_FormCreationParams.
On the form there are several ComboBox-s. In some cases I want to clear the ComboBox, so after actualizing the form the database field connected to it should be NULL.
I checked all the topics but I couldn't find the right solution.
First I tried this:
'// delete DataBound
Call oForm.Items(sDBItems(ii)).Specific.DataBind.SetBound(False)
'// Add an empty line
Call oForm.Items(sDBItems(ii)).Specific.ValidValues.Add("", "")
'// select the empty line
Call oForm.Items(sDBItems(ii)).Specific.Select(0, psk_Index)
'// clear valid values
For jj = oForm.Items(sDBItems(ii)).Specific.ValidValues.Count - 1 To 0 Step -1
Call oForm.Items(sDBItems(ii)).Specific.ValidValues.Remove(jj, psk_Index)
Next jj
'// set back the datasource
Call oForm.Items(sDBItems(ii)).Specific.DataBind.SetBound(True, sPrjTableName, sDBFieldNames(ii))
It looked fine for the first look. It showed nothing as selected on the form. But after pressing the Actualize button and recheck the record, it showed the old value: so I managed to achieve nothing.
I red the following advice: "YOU SHOULD CLEAR THE DATASOURCE RELATED TO IT"
Does it mean, I sould clear the whole user table from the form's DBDataSources? Should I use the DBDataSource.Clear()? But then all the data is lost from the form and I cannot get them back!
It's really strange that I have to fight so much to solve such a simple problem :-((
Thanks in advance,
Tamas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
never mind... found the ocomb.select() method... thanks anyways!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Trinidad:
Actually I have a question regarding the ComboBox. is there a way to preset a combo box on load? like when form load. All the combo box already have values. I couldn't find any properties on the help file or the demos. And I have been looking through the forum, but could't find any solution. You help is greatly appreciated! Thank You!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
YOU SHOULD CLEAR THE DATASOURCE RELATED TO IT
Hagai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe I am not explaining this properly.
It is not a matrix datasource that I want to clear. I have a drop down list on my custom form that is not part of my matrix. It does not have a datasource assigned to it, I had valid values to the combo box from my code. Now when the user hits save on my form I want to clear the selection they have. But I do not want to put an empty valid value in the box and select that, I just want to clear the selection.
User | Count |
---|---|
106 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.