ARTICLE

Windows Forms in VB.NET

Posted by Mahesh Chand Articles | Visual Basic 2010 May 03, 2004
This is a simple tutorial which shows you beginners how to create a WindForms application in VB.NET.
Download Files:
 
Reader Level:

This is a simple tutorial, which shows you beginners how to create a WindForms application in VB.NET.

Create a new project by selecting

File->New->Project->Visual Basic Projects->Windows Application option
-



Pick a suitable directory and project name.

Now use Toolbox to add controls to the form. Drag-drop controls you want.



I add a listbox, a textbox, and a button and my form looks like this -



In this sample example, I will add textbox items to the list box on Button Click event.

Now
double click on the button to add a On click event handler and write this code -

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
ListView1.InsertItem(0, TextBox1.Text)
End Sub

That's it. Compile and build your project. Piece of cake, huh?

share this article :
post comment
 

I do not know the answer. Post it on the forums.

Posted by Mahesh Chand Apr 07, 2009

Write thic code after InitializeComponent method in your code.

Posted by Mahesh Chand Apr 07, 2009

This code adds text entered in the TextBox to the ListBox when you click the button.

Posted by Mahesh Chand Apr 07, 2009

i can add controls on the form but then what is this code.Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) ListView1.InsertItem(0, TextBox1.Text) End Sub. some explanation please especially on by val, eventargs and such. peter

Posted by Peter Namanya Apr 07, 2009

hi I NEED ONE HELP , CAN YOU PLEASE GUIDE ME TO MAKE FLOATING WINDOW APPLICATION IN VB.NET, IT LIKE APPLICATION WHICH WILL KEEP DISPLAYING ON TOP OF THE DESKTOP. IT WILL GET REFERSHED AFTER EVRY 30 SEC AND DISPLAY SOMEOTHER ITEM OF TEXT. I M BEGINEER IN .NET SO PLZ HELP ME . WAITING FOR UR RELY. THANKS

Posted by sanjeev singh Feb 01, 2008
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor