ComboBox.Addrow Trouble

Hello,
I am using a Container Control that contains a combobox and a label.

While running, I create from code more Container Control and when I try to add an empty line using

ContainerControl(4).ComboBox.AddRow ""

this does not work.

While in a combobox created at compile time everything works perfectly.

What’s wrong?

[quote=95313:@Nicola Messina]Hello,
I am using a Container Control that contains a combobox and a label.

While running, I create from code more Container Control and when I try to add an empty line using

ContainerControl(4).ComboBox.AddRow ""

this does not work.

While in a combobox created at compile time everything works perfectly.

What’s wrong?[/quote]
Can you post your instantiation code? What are you seeing also?

Here it is, I wrote rubbish?

[code]
Dim Rs,rs1 as RecordSet
Dim Parametri() as MyParameterBox //Array of container control

Rs=App.dbParam.SQLSelect(“SELECT * FROM ExamParametersGroup WHERE ExaminationTypeId=”+str(App.ExaminationSelected.ExaminationTypeId))

while not rs.EOF
dim P as new MyParameterBox //Container control
P.lblParameter.Text=Rs.Field(“Name”).StringValue //Label
rs1=app.dbParam.SQLSelect(“SELECT * FROM ExamParameters WHERE ParametersGroupId=”+Rs.Field(“id”).StringValue)

  P.cbxParameter.AddRow "" //Not working
  P.cbxParameter.RowTag(0)=-1
  while not rs1.EOF
    P.cbxParameter.AddRow (rs1.Field("Name").StringValue) //Work
    P.cbxParameter.RowTag(P.cbxParameter.ListCount-1)=rs1.Field("ParametersGroupId").IntegerValue
    rs1.MoveNext
  wend
  P.cbxParameter.ListIndex=0
  Parametri.Append (P)
  rs.MoveNext

wend

Vista.cntParameterControl1.LParametri=Parametri[/code]

Apparently the rowTag not work, andiI see on screen the whole list of container control, and the combobox contains only the rows taken from the db, not empty ones.

[quote=95313:@Nicola Messina]Hello,
I am using a Container Control that contains a combobox and a label.

While running, I create from code more Container Control and when I try to add an empty line using

ContainerControl(4).ComboBox.AddRow ""

this does not work.

While in a combobox created at compile time everything works perfectly.

What’s wrong?[/quote]
Is your combobox really named ‘ComboBox’ (ComboBox is the class name)? Or is it named ‘ComboBox1’ or something else?

That was an example, I use this code:

Dim Rs,rs1 as RecordSet
Dim Parametri() as MyParameterBox //Array of container control

Rs=App.dbParam.SQLSelect("SELECT * FROM ExamParametersGroup WHERE ExaminationTypeId="+str(App.ExaminationSelected.ExaminationTypeId))

while not rs.EOF
      dim P as new MyParameterBox //Container control 
      P.lblParameter.Text=Rs.Field("Name").StringValue //Label
      rs1=app.dbParam.SQLSelect("SELECT * FROM ExamParameters WHERE ParametersGroupId="+Rs.Field("id").StringValue)
    
      P.cbxParameter.AddRow "" //Not working
      P.cbxParameter.RowTag(0)=-1
      while not rs1.EOF
        P.cbxParameter.AddRow (rs1.Field("Name").StringValue) //Work
        P.cbxParameter.RowTag(P.cbxParameter.ListCount-1)=rs1.Field("ParametersGroupId").IntegerValue
        rs1.MoveNext
      wend
      P.cbxParameter.ListIndex=0
      Parametri.Append (P)
      rs.MoveNext
 wend
    
    Vista.cntParameterControl1.LParametri=Parametri  //Vista is a window

Oh Yes!
I solved the problem, to make everything work as it should, just add a combobox in control and fill it, not adding after filling.
Is a bug?