In a form, I have a listbox, a textbox, a spinbutton and a button "finish". I created the spinbutton to goes through the listbox and I use the textbox to save values to each property on listbox usin a array MyMtx().
It's almost working:
andCode:Private Sub SpinButton1_Change() If SpinButton1.Value > ListBox1.ListCount Then SpinButton1.Value = ListBox1.ListCount End If If ListBox1.ListCount > SpinButton1.Value And SpinButton1.Value >= 0 And SpinButton1.Value <= ListBox1.ListCount Then ListBox1.ListIndex = SpinButton1.Value End If TextBox1.SetFocus End Sub
Code:Private Sub ListBox1_Change() SpinButton1.Value = ListBox1.ListIndex TextBox1.Text = MyMtx(ListBox1.ListIndex, 2) TextBox1.SetFocus End SubThe spinbutton is working, it can run through the listbox Up and Down, perfect. But, TextBox1.SetFocus is not working. I don't know why, it works just each two times I click on spinbutton, not every time I click.Code:Private Sub TextBox1_Change() On Error Resume Next MyMtx(ListBox1.ListIndex, 2) = TextBox1.Text End Sub




Reply With Quote
