下面的代码如果发生错误,我要怎么跳过,不继续执行?If (ButtonImageListbox.Items.Count > 0) And (ButtonImageListbox.Selected.Indent > 0) Then
begin
ButtonImageListbox.Items[ListPlayId].ImageIndex:=0;
ButtonImageListbox.Items[ButtonImageListbox.Selected.Index].ImageIndex:=1;
End;

解决方案 »

  1.   

    try
    If (ButtonImageListbox.Items.Count > 0) And (ButtonImageListbox.Selected.Indent > 0) Then
    begin
    ButtonImageListbox.Items[ListPlayId].ImageIndex:=0;
    ButtonImageListbox.Items[ButtonImageListbox.Selected.Index].ImageIndex:=1;
    End;
    except
    showmessage('出错了');
    end;
      

  2.   

    不对啊procedure TfrmList.ButtonImageListboxDblClick(Sender: TObject);
    begin
    try
    If (ButtonImageListbox.Items.Count > 0) And (ButtonImageListbox.Selected.Indent > 0) Then
    begin
    ButtonImageListbox.Items[ListPlayId].ImageIndex:=0;
    frmMain.GUPlayer.Open(ButtonImageListbox.Items[ButtonImageListbox.Selected.Index].SubItems[1]);
    ButtonImageListbox.Items[ButtonImageListbox.Selected.Index].ImageIndex:=1;
    frmMain.GUPlayer.Play;
    End;
    except
    showmessage('出错了');
    end;