我用了TcomboBox想来实现自动列举数据库中信息的功能(如:我想列举物品名称),我只要在TcomboBox中输入汉字的第一个拼音字符就能出现相关的以这个拼音开头的汉字!代码如下:
label NotFound;
var
M, J :Integer;
Hzchar :String;
begin
For M:=0 to ruku.ListBox1.Items.Count-1 do
begin
For J:=1 to Length(PYIndexStr) do
begin
Hzchar :=ruku.ListBox1.Items[M][2*J-1]+ruku.ListBox1.Items[M][2*J];
if (PYIndexStr[J] <>'?') and (UpperCase(PYIndexStr[J])<>GetPyIndexChar(Hzchar)) then
goto NotFound;
end;
ruku.ResultList1.Add(ruku.ListBox1.Items[M]);
NotFound:
end;
end;
运行后我在TcomboBox中输入一个音节的拼音,然后点击下拉标记时就会跳出错误!
'Access violation at address 0050C9CF in module''crk.exe'.Read of address 00000000'.Process stop .
请问这是什么原因!!?如果知道的请给出可以解决这个问题的答案!!
我会给分的!谢谢!!
label NotFound;
var
M, J :Integer;
Hzchar :String;
begin
For M:=0 to ruku.ListBox1.Items.Count-1 do
begin
For J:=1 to Length(PYIndexStr) do
begin
Hzchar :=ruku.ListBox1.Items[M][2*J-1]+ruku.ListBox1.Items[M][2*J];
if (PYIndexStr[J] <>'?') and (UpperCase(PYIndexStr[J])<>GetPyIndexChar(Hzchar)) then
goto NotFound;
end;
ruku.ResultList1.Add(ruku.ListBox1.Items[M]);
NotFound:
end;
end;
运行后我在TcomboBox中输入一个音节的拼音,然后点击下拉标记时就会跳出错误!
'Access violation at address 0050C9CF in module''crk.exe'.Read of address 00000000'.Process stop .
请问这是什么原因!!?如果知道的请给出可以解决这个问题的答案!!
我会给分的!谢谢!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货