Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996



Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Dynamically Creating Controls

I am a teacher (this explains my lack of expertise at understanding many VB technicalities in manuals etc.) experimenting with creating bits and pieces of software for children with learning disabilities and would like to know if there is an easy (novice easy!) way of doing this ....
  1. I want to type a letter on the keyboard, and I want VB to automatically create a button with that letter (label) on it on-screen.
  2. I want to type a letter on the keyboard, and I want VB to automatically create a similar button, but with pre-defined properties (perhaps already defined and in a dBase linked to VB).

Here are the basic steps for this:

  1. Create a button on the screen, label it something like cbLetter or whatever.
  2. Set the index property of it to the number zero.
  3. Set the visible property to false.
  4. In the KeyPress event for the TextBox or wherever you are entering keys, to create a new button, you do: Set cbLetter(1) = New CommandButton That will create a new button at index #1. You then need to set the top, left, height and width properties, as well as the caption. There's not really a good way to use a template or anything like that. You basically have to set the properties equal to those on another button, such as the invisible one. It's not a particularly easy thing to do...it becomes a pain to manage.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date