Thursday, 17 October 2013

Reading Data From TEXT BOXES and store them in another TEXT BOX instead of MESSAGE BOX.

Example program:

Reading Data From TEXT BOXES and store them in another TEXT BOX instead of MESSAGE BOX

  • Firstly add 3 LABELS to our FORM identifying 3 TEXTBOXES.
  • Then add a BUTTON and name it as APPEND NAMES by using text property.
  • And also name the LABELS as "FirstName" , "LastName" and "FullName" by using text property.
  • And naming the TEXTBOXES
  •  by using NAME property in the property window as "txtFirstName", "txtLastName" and "txtFullName".
The form design  is shown below:




This is the code for Button to take the input from 2 textboxes and print them in another textbox.
Double click on Button. It opens the code window..
the code is:
        Dim FirstName As String
        Dim LastName As String
        Dim FullName As String

        FirstName = txtFirstName.Text
        LastName = txtLastName.Text

        FullName = FirstName & " " & LastName

        txtFullName.Text = FullName



Instead of MsgBox(FullName)   we write txtFullName.Text = FullName. 
The code is:

Then RUN the form and enter the data into first 2 text boxes:

Then click on button the result will be displayed in 3rd TextBox.






<----Previous page                                                          Next page ---->



VB.NET HOME PAGE