need some fields not editable in data grid VB 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zhang
    New Member
    • Sep 2006
    • 8

    need some fields not editable in data grid VB 6.0

    Hi,

    I try to protect some fields from editing by user after the records of table showing in datagrid using VB 6.0. How can I do?

    Please help

    Zhang
  • CaptainD
    New Member
    • Mar 2006
    • 135

    #2
    Originally posted by zhang
    Hi,

    I try to protect some fields from editing by user after the records of table showing in datagrid using VB 6.0. How can I do?

    Please help

    Zhang
    You can use the keydown event to capture the keycode and using the .col to look at which column they are in, then set the keycode = 0 (I think that is the code number) if you want to protect it. (0 esentially means "nothing" so they press a key and nothing happens inside that cell)

    Comment

    • zhang
      New Member
      • Sep 2006
      • 8

      #3
      Originally posted by CaptainD
      You can use the keydown event to capture the keycode and using the .col to look at which column they are in, then set the keycode = 0 (I think that is the code number) if you want to protect it. (0 esentially means "nothing" so they press a key and nothing happens inside that cell)

      CaptainD,

      I tested as you suggestion. it only work as you press arrow key, any letter key still work as usual. Following is my code:

      Private Sub dbgEquip_KeyDow n(KeyCode As Integer, Shift As Integer)
      Dim colNo As Integer
      colNo = Me.dbgEquip.Col
      If colNo = 0 Then
      KeyCode = 0
      End If

      End Sub

      Anyway, thank you lots

      Zhang

      Comment

      Working...