Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid Column

Status
Not open for further replies.

sp76

Programmer
Jul 1, 2003
59
AU
How can i create a DataGrid Column with TextBox in it.

Is there a way to get rid of underlying TextBox in DataGridTextBoxColumn.

What i am trying to achieve here is: to prevent cursor from tabbing into cells of the DataGrid.


 
SORRY FOR THE TYPO, please ignore previous thread. the question is

How can i create a DataGrid Column without TextBox in it.

Is there a way to get rid of underlying TextBox in DataGridTextBoxColumn.

What i am trying to achieve here is: to prevent cursor from tabbing into cells of the DataGrid.
 
One way is to create an inherited data grid column and override the Edit method, which gives focus to the underlying text box. Instead, we can just send another tab to move focus to the next cell:
Code:
Public Class DataGridNoTextBoxColumn
    Inherits DataGridTextBoxColumn

    Protected Overloads Overrides Sub Edit(ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)

        SendKeys.Send("{TAB}")

    End Sub

End Class
 
Hi SHelton

i tried that, but it never let user access the DataGrid :-(

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top