Q&A

  • ListBox의 MultiSelect 하긴했는데..??? ^^;;
listBox에서 multiselect 한걸 표현하긴했는데..



multiselect된 것이 끝인지를 알수도 있을까여...??



procedure TForm1.Button1Click(Sender: TObject);

var

strtemp : String;

i : integer;

begin



for i := 0 to listBox1.Items.count -1 do

if ListBox1.Selected[i] = true then

strtemp := strtemp + listbox1.Items.Strings[i] + ',';

┖> 이렇게 했더니.. 마지막 자료인데도.. 콤마(,)가 붙어서..

밑에 select 할때 에러가나네여..



with Query1 do

begin

close;

SQL.Clear;

Sql.Add('select * from bdr_info');

Sql.Add(' where saucd in (''' +strtemp + ''')'); <- - - - 여기여.. ^^;;

try

open;

except on E1:EDBEngineError do begin

Close;

end;

end;

end;



multiselect 된것중 맨 끝이면.. 콤마(,)를 빼야하는데.. ^^

3  COMMENTS
  • Profile
    뻐록이 2001.02.22 03:23
    김양미 wrote:

    > listBox에서 multiselect 한걸 표현하긴했는데..

    >

    > multiselect된 것이 끝인지를 알수도 있을까여...??

    >

    > procedure TForm1.Button1Click(Sender: TObject);

    > var

    > strtemp : String;

    > i : integer;

    > begin

    >

    > for i := 0 to listBox1.Items.count -1 do

    > if ListBox1.Selected[i] = true then

    > strtemp := strtemp + listbox1.Items.Strings[i] + ',';

    > ┖> 이렇게 했더니.. 마지막 자료인데도.. 콤마(,)가 붙어서..

    > 밑에 select 할때 에러가나네여..

    >

    '//////////////답변이 될려나 모르겠네요//////////

    //포문 끝나고 나서 이렇게 함 될거 같은데요;.......

    strtemp := copy(strtemp,1,length(strtemp)-1);



    //즐코딩 하세요,....

    //



    > with Query1 do

    > begin

    > close;

    > SQL.Clear;

    > Sql.Add('select * from bdr_info');

    > Sql.Add(' where saucd in (''' +strtemp + ''')'); <- - - - 여기여.. ^^;;

    > try

    > open;

    > except on E1:EDBEngineError do begin

    > Close;

    > end;

    > end;

    > end;

    >

    > multiselect 된것중 맨 끝이면.. 콤마(,)를 빼야하는데.. ^^

  • Profile
    (__)a 2001.05.04 03:30
    요렇게 해두 이쁠듯.



    procedure TForm1.Button1Click(Sender: TObject);

    var

    strtemp : String;

    i : integer;

    TS : TstringList;

    begin



    TS := TstringList.create;

    for i := 0 to listBox1.Items.count -1 do

    begin

    if ListBox1.Selected[i] then TS.add(ListBox1.items[i]);

    end;

    strtemp := TS.commatext;

    TS.Free;



    with Query1 do

    begin

    close;

    SQL.Clear;

    Sql.Add('select * from bdr_info');

    Sql.Add(' where saucd in (''' +strtemp + ''')'); <- - - - 여기여.. ^^;;

    try

    open;

    except on E1:EDBEngineError do begin

    Close;

    end;

    end;

    end;





    뻐록이 wrote:

    > 김양미 wrote:

    > > listBox에서 multiselect 한걸 표현하긴했는데..

    > >

    > > multiselect된 것이 끝인지를 알수도 있을까여...??

    > >

    > > procedure TForm1.Button1Click(Sender: TObject);

    > > var

    > > strtemp : String;

    > > i : integer;

    > > begin

    > >

    > > for i := 0 to listBox1.Items.count -1 do

    > > if ListBox1.Selected[i] = true then

    > > strtemp := strtemp + listbox1.Items.Strings[i] + ',';

    > > ┖> 이렇게 했더니.. 마지막 자료인데도.. 콤마(,)가 붙어서..

    > > 밑에 select 할때 에러가나네여..

    > >

    > '//////////////답변이 될려나 모르겠네요//////////

    > //포문 끝나고 나서 이렇게 함 될거 같은데요;.......

    > strtemp := copy(strtemp,1,length(strtemp)-1);

    >

    > //즐코딩 하세요,....

    > //

    >

    > > with Query1 do

    > > begin

    > > close;

    > > SQL.Clear;

    > > Sql.Add('select * from bdr_info');

    > > Sql.Add(' where saucd in (''' +strtemp + ''')'); <- - - - 여기여.. ^^;;

    > > try

    > > open;

    > > except on E1:EDBEngineError do begin

    > > Close;

    > > end;

    > > end;

    > > end;

    > >

    > > multiselect 된것중 맨 끝이면.. 콤마(,)를 빼야하는데.. ^^

  • Profile
    김양미 2001.02.22 18:26
    *^^*