Pages

Thursday 27 December 2018

How to create Textbox with Suggestion Text

Here are the steps to use textbox with suggestion text input by user.

  1. Drag and Drop the Textbox from Tools panel into GUI Form.


  2. Design and Change the properties of the Textbox control like Name and Text Properties.


  3. Right Click the form and Chose View Code.


  4. Add the Form Load Events.




  5. Add the following code statement inside the form load events.

    1.  
      Dim Col As New Collection
              With Col
                  .Add("Philippines")
                  .Add("Singapore")
                  .Add("Malaysia")
                  .Add("Vietname")
                  .Add("Korea")
              End With

              txtCountry.AutoCompleteMode = AutoCompleteMode.Suggest
              txtCountry.AutoCompleteSource = AutoCompleteSource.CustomSource
              For Each item In Col
                  txtCountry.AutoCompleteCustomSource.Add(item)
              Next

  6. Run the Project and the out may like this.


Download the Project Here.

No comments:

Post a Comment