Solved

Control array

Posted on 2014-11-21
3
158 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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