请问怎样获取dbgrid的单元格的坐标???

解决方案 »

  1.   

    方法一:假设dbgrid和yourttable控件连接。
    用dbcombobox可否,dbgrid.SelectedIndex表示当前列,
    在cellenter中移动combobox,然后把focus放在combobox上
    用户在combobox上有输入时,
    在combobox的dbclick写下面
    的东西:
    1)tquery取产品编码,tquery.sql为:select 产品编码
     from yourtable where left(产品编码,2)=left(combobox.text,2)....,
    2)把记录集值写入combobox的items中。
    在combobox的onchange写下面
    的东西:
    1)用book填好当前位置
    2)把combobox的值写入dbgrid.selectedfield中,
    3)refresh
    4)返回book.....好象太麻繁,但vb中就是这样作的方法二:
    把一个dbgrid和一个dblistbox并排放在form上
    两个高度相同,在dbgrid的ondbclick中同样
    根据dbgrid.SelectedIndex和selectedfield
    当前value改写连接dblistbox的query的sql
    然后把dblistbox的所选值用winapi的wm_char
    一个一个送回dbgrid.
    方法三:
    在深度历险中好象已有类似的控件