注册 登录
编程论坛 VFP论坛

请教列表框如何小写显示

huasinstamps 发布于 2024-02-23 13:26, 234 次点击
我的列表框代码如下:

public yyy[1]
=adir(yyy,"*.*")
=asort(yyy)
thisform.list1.RowSourcetype=5
thisform.list1.RowSource='yyy'

列表框显示的文件名都是大写的。请教各位老师怎么能小写显示?多谢!
6 回复
#2
sdta2024-02-23 13:48
LOCAL aa[2,2]
aa[1,1] = "Abc"
aa[1,2] = "Bcd"
aa[2,1] = "Def"
aa[2,2] = "Efg"
FOR ln = 1 TO ALEN(aa, 1)
    aa[ln, 1] = LOWER(aa[ln, 1])
    aa[ln, 2] = LOWER(aa[ln, 2])
ENDFOR
LIST MEMORY LIKE aa

[此贴子已经被作者于2024-2-23 13:57编辑过]

#3
老去的流星雨2024-02-23 16:31
原因是adir返回的文件名是大写的,需要替换一下
LOCAL yyy[1]
=ADIR(yyy,"*.*")
CREATE CURSOR FileNameList(文件名 V(200))
APPEND FROM ARRAY yyy
REPLACE 文件名 WITH LOWER(文件名) all
thisform.list1.RowSourcetype=2
thisform.list1.RowSource='FileNameList'
#4
huasinstamps2024-02-24 09:44
谢谢楼上两位老师!我按流星雨老师的代码改了我的代码如下

cd d:\vfp\turtles\photo_800
local newlist[1]
=adir(newlist,"*.*")
creat cursor listadir(sours c(200))
append from array newlist
replace all sours with lower(sours)
thisform.pageframe1.page6.pageframe1.page1.list1.RowSourcetype=2
thisform.pageframe1.page6.pageframe1.page1.list1.RowSource='listadir'
cd\vfp

但运行时提示出错 - 找不到“字段”表达式。。。麻烦老师指点下
#5
sdta2024-02-24 10:08
临时表的路径和表单的路径是否相同?
页框中加页框?

[此贴子已经被作者于2024-2-24 10:10编辑过]

#6
老去的流星雨2024-02-24 10:48
回复 4楼 huasinstamps
我测试了一下代码,没有问题,你挂起一下,看看报错的代码是不是其他地方的
#7
huasinstamps2024-02-26 10:06
思路我了解了,过会我再试下应该问题不大。非常感谢!
1