• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

ListBox With KeyDown Event

delta

Member
my userform contain
Textbox1 ,Textbox2 ,Textbox3 ,Textbox4 ,Textbox5 ,Textbox6
Listbox1
command button
I make keydwon event in last TextBox6(Rate) when enter key is press in Textbox6 then data should be add in Listbox1
Sub TextBox_Data_To_List_Box() ' Textbox data transfer to listbox

>>> use code - tags <<<
Code:
Private Sub TextBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
With UserForm1
    If KeyCode = 13 Then

         Call Module3.TextBox_Data_To_List_Box
         .TextBox2.Value = .TextBox2.Value + 1
          .TextBox4.Value = ""
          .TextBox5.Value = ""
          .TextBox6.Value = ""
          .TextBox4.SetFocus
    End If
End With
End Sub
When double click in any item in listbox1 then show item in respectively in their TextBoxs

Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

Dim i As Integer
    On Error Resume Next

With UserForm1
    For i = 1 To .ListBox1.ListCount - 1

            If .ListBox1.Selected(i) Then
          
                .TextBox1 = .ListBox1.List(i, 0)
                .TextBox2 = .ListBox1.List(i, 1)
                .TextBox3 = .ListBox1.List(i, 2)
                .TextBox4 = .ListBox1.List(i, 3)
                .TextBox5 = .ListBox1.List(i, 4)
                .TextBox6 = .ListBox1.List(i, 5)
              
            End If
    Next i
  
  
End With

End Sub

Now my problem is when double click any item of the listBox for update then item will be show in Textoboxes and changes made then same item show in llistbox with update with changes by keydown event in TextBox6(Rate) .i
In short I Like to TextBox Data Add to Lilstbox by Keydown event in TextBox6 (Rate) as well as
LIstbox Data Update by Keydown event in TextBox6(Rate)
For more clarification I attach the file
 

Attachments

Last edited by a moderator:
Back
Top