.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Add New Button At Runtime

Posted By:Ghanashyam Nayak       Posted Date: December 04, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

Code for add new button at runtime

Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButton.Click
        Dim MyButton1 As New Button()

'Set the button properties...
        With MyButton1
	.Location = New Point(10, 10)
	.Text = "New Button"
	.Size = New Size(75, 30)
        End With

        AddHandler MyButton1.Click, AddressOf MyButton1_Click
End Sub

Private Sub MyButton_Click(ByVal obj As Object, ByVal e As EventArgs)
        MessageBox.Show("New Added Button Clicked...")
End Sub


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend