Hey guys i have a gridview on my form with readonly = false and enabled = true so i can select a part of the text in a cell of a datagridview. This works ok but when i have the settings like this its also possible to edit the text and thats the part i dont whant.
So i am looking for a solution to be able to select a part of the text within a cell of a datagridview but dont allow the users to edit the values that are in there.
Tanx in Advantage
dataGridView1.ReadOnly = false and dataGridView1.enabled = true
Private Sub dataGridView1_EditingControlShowing(sender As Object, e As DataGridViewEditingControlShowingEventArgs)
If TypeOf e.Control Is TextBox Then
' Set the TextBoxCell to readonly
Dim textBoxCell As TextBox = DirectCast(e.Control, TextBox)
textBoxCell.[ReadOnly] = True
End If
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.