Hi, im new here, and i need some help,

Im developing a Plugin management system, and i need to know what code i should use to check if anything is actually selected.

This is the code i need the above added to:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim assemblyInstance = System.Reflection.Assembly.LoadFrom(CurDir() & "\plugins\" & ListBox1.SelectedItem.ToString)
        MessageBox.Show(assemblyInstance.GetName.ToString, "Plug-In Details")
        Build_Lists()
    End Sub

I need some code, so that when i click Button4, it checks if something is selected, then does the above, and if nothing is selected, does nothing.

Thanks in advance!

Try this:

If ListBox1.SelectedIndex = -1 Then MessageBox.Show("Not selected!")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.