This has been a guide to VB.NET Controls. Mastering the controls, their properties and their methods help a lot in creating intuitive and user-friendly User Experiences. ConclusionĬontrols are one of the most useful features of VB.NET in designing and creating Forms. Similar to the views in Windows Explorer, with ListView control, we can display a collection of items in 4 different views. Just like in Windows Explorer, a treeview allows us to create a hierarchical collection of items. This is used to show a Windows Progress bar, this bar can represent an ongoing process such as moving a file or exporting a document. This saves the hassle of creating multiple text boxes for one input. In cases where you need to ask the user about date and time, VB.NET has a readymade control that lets the user pick the date and time via a Calendar and a clock. Verticalscroll.Location = New Point(300, 35) Horizontalscroll.Size = New Size(185, 20) Horizontalscroll.Location = New Point(15, 300) When the content in the form is too large to be shown at once, we can use ScrollBars to let users scroll to see the remaining content, it can be vertical, horizontal or even both depending on the circumstances. The image can be of any supported format and we can select the size of the object in the form too.Įxample: Private Sub Submit_Click(sender As Object, e As EventArgs) Handles Submit.ClickĮxamplePictureBox1.ClientSize = New Size(500, 500)ĮxamplePictureBox1.SizeMode = PictureBoxSizeMode.StretchImage This VB.Net control is used to show images and graphics inside a form. Msg = msg & " ExampleCheckBox2 Selected " Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Private Sub Example_RadioButton3_CheckedChanged(sender As Object, _Į As EventArgs) Handles RadioButton3.CheckedChangedĬheckboxes are similar to radio buttons in the way that they are also used in groups, however, a user can select more than one item in the group. Private Sub Example_RadioButton2_CheckedChanged(sender As Object, _Į As EventArgs) Handles RadioButton2.CheckedChanged Private Sub Example_RadioButton1_CheckedChanged(sender As Object, _Į As EventArgs) Handles RadioButton1.CheckedChanged Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load The programmer can set any of the buttons as default if needed. Radio Button is one of the popular ways of limiting the user to pick just one option. ![]() Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button2.Click A user can enter both text in the box or he can click on the downwards aero on the right side and select any item. It is similar to the list but it works as a dropdown for the user. Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) MsgBox("The country you have selected is " + ()) Private Sub BTN1_Click(sender As Object, e As EventArgs) Handles BTN1.Click Private Sub dropexmaple_Load(sender As Object, e As EventArgs) Handles MyBase.Load Users can select any options from the list. Private Sub quitBTN _Click(sender As Object, e As EventArgs) Handles quitBTN.ClickĪs the name suggests, this control works as a way to display a list of items on the application. Private Sub ButtonExmaple_Load(sender As Object, e As EventArgs) Handles MyBase.Load In most cases, the Button Control is used to generate a click event, its name, size and appearance are not changed in the runtime. It is used to show any text to the user, typically the text in a label does not change while the application is running. ![]() ![]() MessageBox.Show("Thanks " + txtName.Text + " from all of us at " + txtOrg.Text) Private Sub btnMessage_Click(sender As Object, e As EventArgs) _ Private Sub Example1_Load(sender As Object, e As EventArgs) _ The user can add strings, numerical values and a combination of those, but Images and other multimedia content are not supported. Text BoxĪs you can guess, it is used to accept textual input from the user. VB.NET has a variety of controls, below given are the list of commonly used controls. Property = Value Common Controls in VB.NET Following is the syntax to tweak properties of a control: Object. The properties can be changed via the Pre parties pane or by adding the specific values of properties into the code editor. Once you have added a VB.NET control to the form, you can change its appearance, its text, its default values, position, size, etc. Events describe what happens when the user/Object takes any action.Methods are used to make the object do something.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |