Block of Code

Practical Examples for Programmers

  • Home
  • C++
  • Java
  • Visual Basic
  • Discrete Math
  • Ask a Question

Text Box

In Visual Basic, create the interface which is shown below.  The user can disable or enable the textbox by clicking on the appropriate button.  After the user clicks the Enable button, the text box should receive the focus.

Text Box

Suggested Control Names and Attributes:

Name Property Text Property Control Type Notes
frmTextBox Text Box Form Holds Controls
txtBox Text Box Blank text box
btnDisable Disable Text Box Button Disables the text box.
btnEnable Enable Text Box Buton Enables the text box.

Write the Code:

' Project: Text Box
' Programmer: Your Name Here
' Date: January 27, 2014
' Description: Creates a text box and two buttons which enable or disable the text box.

Public Class frmTextBox

   Private Sub btnDisable_Click(sender As Object, e As EventArgs) Handles btnDisable.Click
      txtTextBox.Enabled = False
   End Sub

   Private Sub btnEnable_Click(sender As Object, e As EventArgs) Handles btnEnable.Click
      txtTextBox.Enabled = True
   End Sub

End Class

Secondary Sidebar

This is the secondary sidebar

Copyright © 2025 · Metro Pro Theme on Genesis Framework · WordPress · Log in