Home > Net >  Disable further listbox input after subroutine is called in Visual Basic
Disable further listbox input after subroutine is called in Visual Basic

Time:10-14

Here is my subroutine which is called by double clicking text in the listbox "LstAnswer4" I have 4 listboxes on the form and want to disable any further inputs after double clicking one of them.

    Public Sub LstAnswer4_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstAnswer4.MouseDoubleClick
    If res4 = 2 Then
        MsgBox("correct")
        Score = Score   1
        ListBox1.Items.Clear()
        Dim displayscore As Object
        displayscore = (Score & " out of " & outof)
        ListBox1.Items.Add(displayscore)
    Else MsgBox("wrong")
    End If
        End Sub

CodePudding user response:

We can disable the listboxes like so:

Listbox1.Enabled=false

CodePudding user response:

Me.Enabled = False

to be very safe :)

  • Related