被 listbox整瓜了???help??help???

wxh850619 2005-04-30 10:01:27
procedure TForm5.Button1Click(Sender: TObject);
var
i:integer;
begin
for i:=0 to listbox3.Count -1 do
if listbox3.Selected[i] then
begin
adoquery3.SQL.Clear ;
adoquery3.Close ;
adoquery3.Connection :=adoconnection1;
adoquery3.SQL.Add('select * from userspriv where privid="'+edit4.Text+'" and usersid="'+edit2.text+'"');
adoquery3.Open ;

if adoquery3.eof then
begin
listbox2.Items.Add(listbox3.Items[i]);
listbox3.DeleteSelected ;

adoquery3.sql.Clear ;
adoquery3.Close ;
adoquery3.Connection :=adoconnection1;
adoquery3.SQL.Add('insert into userspriv(usersid,privid,privname) values("'+edit2.text+'","'+edit4.text+'","'+edit3.text+'")');
adoquery3.ExecSQL ;
end;
if listbox3.Items.text='' then
begin
button3.Enabled :=false;
end;
end;
end;


请各位大虾帮忙为什么总是提示"list index out of bounds(2)"错误了???

在线等~~~~~~~~~~~~~~
...全文
92 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxh850619 2005-04-30
  • 打赏
  • 举报
回复
Thank You Very Very Very VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery Much~~~~~~~!
wxh850619 2005-04-30
  • 打赏
  • 举报
回复
你的意思是说把for i:=0 to listbox3.Count -1 do
换成for i:=ListBox3.Count-1 downto 0 do就可以了吗?
gzmhero 2005-04-30
  • 打赏
  • 举报
回复
List项删除会造成Count改变,而循环不变,造成越界。

for i:=0 to listbox3.Count -1 do
------------->>>>>>>>>>>>>>>>>>>>>>>.
for i:=ListBox3.Count-1 downto 0 do
就OK了。
Note that Delphi IDE does not move components to the new default place on components palette when you install new version of same component(s). So if you already has EhLib installed, then installation new (3.0) version does not move EhLib components to the 'EhLib' page. To force Delphi IDE to move compontes to the default place on components palette do next: Open menu: Component->Configure Palette. Select '[All]' line in Pages listbox. Click 'Default Pages' button. 4. Installation Help ----------------- 1. This version of library doesn't have help files for Delphi8 and Delphi2005. 2. Delphi 4.x - 7.x: Copy the EhLib.hlp and EhLib.cnt files to the Delphi HELP subdirectory. Select Help|Customize to start the OpenHelp application. Add the EhLib.cnt file to the Contents page, add the EhLib.hlp file to the Index and Link pages. 3. C++Builder 4.x - 6.x: Copy the EhLib.hlp and EhLib.cnt files to the C++Builder HELP subdirectory. Select Help|Customize to start the OpenHelp application. Add the EhLib.cnt file to the Contents page, add the EhLib.hlp file to the Index and Link pages. 5. Demonstration Programs ---------------------- Demonstration programs use tables from the DEMOS directory and BDE alias "DBDEMOS". DEMOS/DEMO1 - Demonstration of use TDBGridEh, TPrintDBGridEh, TDBLookupComboboxEh and TPreviewBox. Requare EhLibBDE.Pas file from DataService directory DEMOS/DirTree - Demonstration of use TDBGridEh and TMemTableEh in tree-view mode. DEMOS/IbDemo - Demonstration of use TMemTableEh, TBDEDataDriverEh. DEMOS/MasterDetailType3 - Demonstration of master/detail relation for TMemTableEh component. DEMOS/SQLDataDriver - Demonstration of use TSQLDataDriver. DEMOS/TreeView - Demonstration of use TDBGridEh and TMemTableEh in tree-view mode
ComponentOne Studio for Windows Phone 2013 v1 Part of: Ultimate | Enterprise 20+ fully-charged Windows Phone 8 controls for data visualization, rich text editing, data input, PDF viewing, and more. Expand your toolbox and enhance your apps. ComponentOne Studio® for Windows Phone includes over 20 UI controls for data visualization, rich text editing, data input, PDF viewing, layout and more. Designed to enhance the rich user experience of the Windows Phone 8, these Silverlight controls give you powerful and unique functionality to help you build better and more compelling apps. 2013 v1 Now Available! Download the 2013 v1 update to access the new Tile controls as well as Windows Phone 8 support. See the what's new details. What's Inside? Calendar FlexGrid Chart Maps PdfViewer RichTextBox ContextMenu CoverFlow DateTimePicker Excel Gauges Imaging Input Layout Panels ListBox PDF Popup ProgressBar Tiles ToggleSwitch Zip Show Less Why use Studio for Windows Phone? Consistent Metro UI Design Consistent Metro UI Design Studio for Windows Phone supports the Metro UI design and interaction guidelines specified by Microsoft. By default, each control supports a Metro look and automatically inherits the dark or light theme set by the user. Be confident that your apps will look consistent on your users' phones. Stunning Data Visualization Stunning Data Visualization Your charting apps are just a few clicks away with Chart for Windows Phone offering over 30 chart types, user interaction, and a wide range of color palettes. Gauges for Windows Phone, with a variety of designs and shapes, give you dashboard-style visualization perfect for the mobile platform. XAML Styling Made Easy: ClearStyle Technology XAML Styling Made Easy: ClearStyle Technology ClearStyle Technology is our new paradigm to XAML control styling. ClearStyle allows developers to easily change control colors without having to modify control templates. By just setting a few brush properties in Visual Studio 2010 you can quickly give a unique look to the control without having to work in Expression Blend or hire a professional designer. Maps Powered By Esri Maps Powered By Esri ComponentOne has partnered with Esri, the leading online map and GIS provider, to bring you the best mapping tools and UI controls together in one package. Easily transform GIS data into business intelligence with controls for Windows Phone with Maps powered by Esri®. The Maps powered by Esri utilize the powerful mapping, geocoding, and geoprocessing capabilities provided by ArcGIS Server.

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧