VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



VB.NET :- Add Controls In Runtime With Control Events

by Gehan Fernando (47 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Mon 1st October 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)

VB.NET :- Add Controls In Runtime With Control Events

Rate VB.NET :- Add Controls In Runtime With Control Events




        Lstbox = New ListBox()
        Dim Pnt As Point = New Point(10, 10)
        LstBox.Location = Pnt
        Dim MSize As Size = New Size(Me.Width - 30, Me.Height - 50)
        LstBox.Size = MSize
        Me.Controls.Add(LstBox)
        LstBox.Visible = True

        For i As Integer = 1 To 100
            Lstbox.Items.Add("Item Index :- " & i)
        Next

    End Sub

    Private Sub Lstbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lstbox.Click

        MessageBox.Show(Lstbox.SelectedItem.ToString(), "Test Data", MessageBoxButtons.OK, MessageBoxIcon.Information)

    End Sub

Download this snippet    Add to My Saved Code

VB.NET :- Add Controls In Runtime With Control Events Comments

No comments have been posted about VB.NET :- Add Controls In Runtime With Control Events. Why not be the first to post a comment about VB.NET :- Add Controls In Runtime With Control Events.

Post your comment

Subject:
Message:
0/1000 characters