我通过row,col在datagrid中使某一个单元格获得焦点,但是怎么才能使得此格子获得焦点的时候的文本全部选中哪?

解决方案 »

  1.   

    获得焦点时,默认就是让文本选中呀
    Private Sub Command1_Click()
        DataGrid1.Col = 1
        DataGrid1.Row = 2
        DataGrid1.SetFocus
    End Sub
      

  2.   

    DataGrid1.SetFocus
     DataGrid1.Row = 2
     DataGrid1.Col = 3
     DataGrid1.SelStart = 0
     DataGrid1.SelLength = Len(DataGrid1.Text)
      

  3.   


     DataGrid1.Row = 2
     DataGrid1.Col = 3
     DataGrid1.SelStart = 0
     DataGrid1.SelLength = Len(DataGrid1.Text)
     DataGrid1.SetFocus