Dynamically Creating Controls

Dynamically Creating Controls

Question:
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).

Answer:
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:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes