delphi - How to know that user selected some row in DBGrid? -


i have dbgrid , button "delete" outside dbgrid. how can determine, user selected string in dbgrid? because if form opens , no strings selected in dbgrid, , user clicked button "delete" - need show him alert box "no strings selected! select string want delete."

you need @ dbgrid1.selectedrows

procedure tform24.button1click(sender: tobject); var   bookmarklist: tbookmarklist;   bookmark: tbookmark;   i: integer; begin   bookmarklist := dbgrid1.selectedrows;    if bookmarklist.count = 0     showmessage('no strings selected! select string want delete')   else   begin     := 0 bookmarklist.count - 1     begin       clientdataset1.gotobookmark(bookmarklist[i]);       clientdataset1.delete;     end;   end; end; 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -