how to write a programme for a list box having 10 items in that just by a single click on one of the item it should be written on the button

if a list is containing notepad than by clicking on the button it should open the notepad
please help me understand using code
i hope i'll be responded as soon as possible

I'm not exactly sure what you meant by this question. But from what I've gathered I wrote this bit of code. I hope it helps you.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'I'm adding these items to the listbox, i don't know what YOUR items are.
        '...but I'm going to use these.
        '...Since you know what your items are, you could skip this whole procedure...
        Dim sListItems As String() = {"Internet Explorer", "Registry Editor", "Notepad"}
        ListBox1.Items.AddRange(sListItems)

    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        'Don't do anything if no items are selected because we will get an error if we do.
        If ListBox1.SelectedIndex < 0 Then Exit Sub

        'Get currently selected item's text
        '...I assume you are not allowing multi-select, so we will just get the first item selected
        Dim sItem As String = ListBox1.Items.Item(ListBox1.SelectedIndex)

        'Which item was selected? we'll see by its text.
        Select Case LCase(sItem)
            Case "internet explorer"
                'You said: "if a list is containing notepad than by clicking on the button it should open the notepad"
                '...so let's "open" it.
                'Internet Explorer Item was selected. Let's open Internet Explorer...
                Shell("C:\Program Files (x86)\Internet Explorer\iexplore.exe", AppWinStyle.NormalFocus)
                'You said: "by a single click on one of the item it should be written on the button"
                '...so let's "write it on the button"?
                Button1.Text = sItem
            Case "registry editor"
                'You said: "if a list is containing notepad than by clicking on the button it should open the notepad"
                '...so let's "open" it.
                'Registry Editor Item was selected. Let's open Registry Editor...
                Shell("regedit.exe", AppWinStyle.NormalFocus)
                'You said: "by a single click on one of the item it should be written on the button"
                '...so let's "write it on the button"?
                Button1.Text = sItem

            Case "notepad"
                'You said: "if a list is containing notepad than by clicking on the button it should open the notepad"
                '...so let's "open" it.
                'Notepad Item was selected. Let's open Notepad...
                Shell("notepad.exe", AppWinStyle.NormalFocus)
                'You said: "by a single click on one of the item it should be written on the button"
                '...so let's "write it on the button"?
                Button1.Text = sItem

        End Select
    End Sub
End Class
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.