Dynamically Creating Controls

I am a teacher (this explains my lack of expertise at understanding many VB technicalitiesin 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 ina 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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS