1) Grid 控件要设置列宽除了用 .colwidth(1) = 1000,能用 formatstring 属性吗?怎么写?2) 要设置窗体上所有的 textbox 的 text 为 "hello"
dim obj as object,fm as form    for each obj in fm
if typeof obj is textbox then
    obj.text = "hello"
end if
    next    在运行时提示“要求对象”的错误。

解决方案 »

  1.   

    第二个问题:定义控件数组来实现。
    如果有0-19个textboxFor i=0 to 19
        text1(i).text="hello"
      

  2.   

    写得急,漏了一个 next
    For i=0 to 19
        text1(i).text="hello"Next
      

  3.   

    第一个问题,可以用.formatstring="aaaaaaaaa|bbbbbbbbbbb|ccccccccc"
    这样自动设置表头,并且宽度恰好合适第二个问题不明白你想要干什么
      

  4.   

    if typeof obj is textbox then 改为 if obj is textbox then 试试
      

  5.   

    我晕 如果我也不清楚有几个 text1,怎么用 for i =  0 to 19 这个循环啊。就想用 for each 这样的循环。
      

  6.   

    第一个问题直接去GRID里设置就OK了,,,你想要多长就多长,,第二个问题:
    你可以把它创建一个控件组不就成了,,,