Solved

Control array

Posted on 2014-11-21
3
161 Views
Last Modified: 2014-11-21
Hi Experts,

I have a group of command buttons (around 50). When I read "1" from database I want to make 1 button visible. When I read "2" I want to make 2 buttons visible. and so on...I put all the buttons in groupbox control.


Thank you.
0
Comment
Question by:RadhaKrishnaKiJaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40458261
And your question is...
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 40458355
You want to make random buttons visible?...or more likely, certain ones based on some kind of naming convention you might have implemented for them?  Do you have these buttons listed in any kind of array / list already?

Give us more details...
0
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 500 total points
ID: 40458445
You may do this either using Control List, or dynamically creating your controls as an example as given here in the below link, and change to create buttons instead of other controls, and use it for your dynamic creation of buttons. You may call the AddControl function as many times you wish, as also the RemoveControl functionality can be implemented:

Button DynButton;

if (ControlType.EndsWith("Button"))
   {
      DynButton = (System.Windows.Forms.Button)ControlObject;
      DynButton.Width = 200;
      DynButton.Text = "Dynamically Added Textbox.";
      DynButton.Click += new System.EventHandler(DynCtrl_Event);
   }

Open in new window


Refer: How to dynamically add a control without hardcoding the control type in Visual C# .NET or Visual C# 2005

HTH
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question