TsDBRadiogroup – List index out of range

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36043
    Siegbert
    Participant

    Hello,

    I have a TsDBRadioGroup on my form. The items-property ist set to:

    • simple label
    • enhanced label

    The values-property is set to

    • s
    • e

    Database field is CHAR(1) with value “e”.

    At designtime all works fine. When I set the query active, the radiogroup marks the item for “e” (“enhanced label”).

    At runtime the following code during the start of the application fails:

    Code:
    Application.CreateForm(TfrmSettings, frmSettings);

    The message is (translated from german): “List index out of range (1)”

    The debugger shows the following code from the unit sDBRadioGroup:

    Code:
    procedure TsDBRadioGroup.DataChange(Sender: TObject);
    begin
    if FDataLink.Field <> nil then
    Value := FDataLink.Field.Text
    else
    Value := '';
    end;

    The line “Value := FDataLink.Field.Text” is marked in debugger.

    I tried to change the values-field to “0” and “1” for the both settings – same result.

    Also I tried to change the field-type to numeric (maybe that the ItemIndex is used instead of the values-property) – same result.

    What is wrong here?

    thanks,

    Siegbert

    #51576
    CheshireCat
    Participant

    Hello Siegbert,

    your database is already open when the line below is executed?

    Code:
    Application.CreateForm(TfrmSettings, frmSettings);

    I suspect an access to data fields of a closed database.

    #51577
    Siegbert
    Participant
    'CheshireCat' wrote:

    Hello Siegbert,

    your database is already open when the line below is executed?

    Code:
    Application.CreateForm(TfrmSettings, frmSettings);

    I suspect an access to data fields of a closed database.

    The Database is open. The query is opened in datamodule and datamodule is created before the settings-form.

    Siegbert

    #51578
    Siegbert
    Participant

    I solved it:

    the property “itemindex” was set to 1. Resetting it to -1 solved the problem.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.