for I := 0 to ListBox1.Items.Count -1 do begin if ListBox1.Selected[I] then ListSelectItem := I; ListBox1.Selected[I] := False; end; ListBox1.Selected[ListSelectItem] := True;
VB.NET code:
for I = 0 to ListBox1.Items.Count -1 do if ListBox1.Selected[I] is True then ListSelectItem = I else ListBox1.Selected[I] = False end if end for ListBox1.Selected[ListSelectItem] = True
ÔÚvbÖÐÔõôÅжϣ¬²åÈëµ½Êý¾Ý¿âÖеÄÖµÊÇÖظ´µÄ£¬±¾È˲ŸսӴ¥VBÓïÑÔ£¬ÉõÊÇÓкöàµØ·½»¹²»¶®£¬»¹Çë¸÷λ´óÏÀÃǸø³ö´úÂ룬ллÁËѽ£¡£¡£¡ ²åÈë֮ǰselectһϰ¢¡£ »òÕßдһ¸ö×éºÏSQL²åÈëÓï¾ä£¬ÀýÈç IF not Exist( & ......