3

In my ComboBox there are items like A B C D and bydefault the value is A where i want to make it as C something like comboBox.comboType(2) in the init form, but this doesnt seems to work. May be ComboBox.selection(2) helps, m not sure, Kindly help.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
piku
  • 471
  • 4
  • 12
  • 44

2 Answers2

2

You can use this code in the form's init method after super():

ComboBoxName.selection(ComboBoxName::DefaultValue);

If this is a table field I'd suggest overriding the initValue method in the table:

this.ComboBoxName = ComboBoxName::DefaultValue;

Override initValue in the form's datasource only if it should be a specific behaviour in this form only.

10p
  • 5,488
  • 22
  • 30
  • thanks, i got confused whether to write the code in `init` or `initValue` but your answer clarified my doubts...thnks once again. – piku Apr 27 '11 at 06:35
  • could you plz explain the reason of using the code after `super()`? – piku Apr 27 '11 at 11:02
  • And also `this.ComboBoxName = ComboBoxName::DefaultValue;` is not working instead i have to put the datasource name then only it works why? – piku Apr 27 '11 at 11:13
  • 1
    1) If you try using it before `super()` you'll get a "FormComboBoxControl object not initialized" error message. 2) "this.ComboBoxName" should be used in "\Data Dictionary\Tables\TableName\Methods\initValue" – 10p Apr 27 '11 at 15:34
0

All I did is overrided the initValue method of the form n wrote the code as tableName.ComboBoxName = ComboBoxName::DefaultValue;

And its working fine. Correct me if I am wrong :)

piku
  • 471
  • 4
  • 12
  • 44