Manage Controls If There Are Many Many Controls Placed On The Forms?

Dec 10, 2006

I would like to know how do .net developers manage a large window application with a large number of controls, such as textbox , button, groupbox? I have seen a number of people do it this way : declare the controls as an array and initialize them one by one at run time . In this way it is easy to manage those controls because they can be accessed by array index; but this solution seems to require very good understanding of control's attribute such as its location, font etc. This could be a difficult task if the project is passed on to a less experienced developer and add changes to it.How do you deal with it?

View 8 Replies


ADVERTISEMENT

Manage A Large Number Of Similar Controls In A User Interface (such As Button Or TextBox Controls)

Aug 23, 2011

There is newer code in a follow up post. I suggest using the code in the later post rather than the code in this one. You can still read this post though. When designing a user interface, one should be conscious of how many individual controls are required to implement the functionality. In some cases an initial design may begin with many buttons or textboxes (for example) but then further review of
the actual required functionality allows for a reduction in the number of unique controls.

But other times, there isn't a better way (which will still make sense to the user of the application) then to have a series of many repeated controls. So in the cases where one can be certain that the best UI implementation for an application will require the use of multiple copies of a given control, then it often becomes necessary to maintain some method of managing all of those controls at various points
throughout the application. Doing so typically requires that one build up some collection of controls which can then be accessed by index in order to work with any given control; but this can lead to a lot of clutter in the code file which handles these control's events. For instance there will be some kind of collection declaration, some recursive routine to find all of the controls of interest, and then any number of event handler methods with long lists of Handles clauses, or additional code loops to wire up the event handling for each control.

Purpose Since most of this functionality could be considered a requirement regardless of the type of control being managed, or its required functionality, it may make sense to wrap all of the control management functionality into a single class. And since our first requirement is a collection of controls, then a base collection class could be the perfect starting point for our control manager. There are a number of existing thread around this topic, with some recent (at the time of this writing) ones being:[URL]..In this, and related, threads I have posted examples of a simple TextBoxManager and ButtonManager control. But again, with so much similar functionality required regardless of the control being managed, it would be technically possible to create a generic ControlManager(Of T As Control) class which can manage any type of control.

[Code]...

So in summary, one can facilitate managing a large number of user interface controls by building a "control manager" class which both encapsulates the list of control instances, and deals with adding and removing defined event handlers for every control it manages. The generic control manager class itself can be inherited and extended into a more specific class on a per-application basis in order to provide more application-specific functionality. Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

View 9 Replies

Forms :: Dynamic Controls Disposal - Only 50% Of Controls Removed?

Sep 17, 2010

I have a query about dynamically added controls to a form. I have a series of buttons which are created and added at run time. I have a two drop down lists and two buttons which are created at design time. Button 1 creates a series of buttons called "Test 1.x" based upon the selection of the two drop down lists. This works fine and am happy with the logic.However.... Button two should remove all the dynamically created buttons from the form.This does not happen. What does happen is that 50% of the buttons are removed starting with the first one. WHen checking the loop it only enters the loop half the amount of times that there are buttons. Very strange. When the loop is run repeatability it will remove all controls. Why will my logic not remove all the dynamically created controls at once? What is wrong with my logic?

I attach two code snippets and the .net file for your consideration.Button method which creates the dynamically created buttons from the two drop down lists and adds to form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Count As Integer
Dim MaxHours As Integer

[code]....

View 3 Replies

Create And Manage 10 WebBrowser Controls?

Feb 18, 2009

I've created some messy code to look at the Readystate of each WebBrowser control and using boolean variable to track which WebBrowser control is done what. The time it takes to load 1000 URL's with one WebBrowser control is about 10 minutes. Multiple controls are needed for speed.

Here's the pseudocode of what I want to do:

Read a line from a file

Which WebBrowser is currently available to do work
Navigate to URL
Which WebBrowser is done loading a URL

[Code].....

View 6 Replies

Accessing The Click Event In Layered Controls Or When Multiple Controls Are Docked Within Each Other?

May 22, 2009

I wanted to know if anyone could tell me how to access the Click_event.I have a boarderles form with a panel control which has the Dock property set to fill and on the panel I have placed a Label also with the Dock property set to fill. I also have a timer running.How can I get code to execute in the Label1 click event.I've tried doing it by using the generic Click_event and also with two variations of the Click_event Handles parameters

'Alternativ 1:
Private Sub Form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

[code].....

View 16 Replies

Accessing Controls Inside ASP.NET View Controls (Event Handling)?

Nov 8, 2011

If I have the following ListView, how can I attach a SelectedIndexChanged event listener to the DropDownList so I can perform a command on the respective object? Imagine I have a list of new users and I want to add them to a usergroup by selecting the group from the DropDownList.

<asp:ListView ID="NewUsers" runat="server" DataSourceID="NewUsersSDS" DataKeyNames="ID">
<LayoutTemplate>

[Code].....

View 1 Replies

Control Recommendations - Controls At The Top Of It And A Large DataGridView Is Docked Below All The Controls

Nov 10, 2011

I have a maximized form that has controls at the top of it and a large DataGridView that is docked below all the controls. Its kind of like the Ribbon in MS Office. The controls cover about 1/4 of the screen at the top. I would like a way for the user to click a button to hide all the controls then automatically expand into the place the controls were so the user can view more data in the DataGridView and visa versa. For example, in MS Office Excel you can hide the ribbon by clicking a tiny button that has "^" on it.

I'm not very familiar with all the controls in Visual Studio so I would like to hear some recommendations. Is this situation ideal for a SplitContainer or ToolStripContainer or am I way off base here?

View 8 Replies

NumericUpDown Controls - Update Some Variables Each Time One Of These NumUD Controls Changes Value

Nov 20, 2011

I've got a couple of these NumericUpDown controls I put on a form. Without describing too much about the form I basically want to update some variables each time one of these NumUD controls changes value. So for each NumUD I have a call to a Recalculate subroutine within their "changedValue" event.

There are actually two problems. First, if I initialize the "Value" property to something other than zero in VB2010 at DESIGN TIME it won't even open the form when I hit RUN. It gives me a "No Source Available. No symbols loaded for any call stack frame" error. The error box says "InvalidOperationException" was not handled. So if I try to set the initial value of the Value property to anything but zero of either I get this error.

[Code]...

View 7 Replies

Container Controls Access Controls At Design Time?

May 13, 2009

I've been building controls for many years professionally and personally, but even back in VB6 days I just could not work this out. After all this time I remembered about it again.If I create a usercontrol/containercontrol and add one or more controls to the controls surface, I just cannot figure out how to access the controls at design time.

View 4 Replies

Draw A Rectangle Over Some Controls So That The Controls Are Partly Obscured

May 18, 2010

I want to draw a rectangle over some controls so that the controls are partly obscured.

View 2 Replies

Looping Controls / Migrating Among Controls In Control Array

Jun 19, 2009

i have created control array , now i wann to loop around as well wann to find which control has triggered the respective event my code :

[Code]...

View 20 Replies

Remember All Controls - Object Browser In VS Contains Many Controls And Properties

Jun 10, 2011

The object browser in visual studio contains many controls and properties ....so is it possible to remember in mind all these controls. Whenever i am programming in vb 2008 and for reference i look at the examples on internet i always find some new controls,properties etc which makes me confuse.So i was wondering If by any means there is a way to remember all these controls

View 4 Replies

Setting A 'default' Value To Controls (textbox) (loop Controls)?

Nov 11, 2009

I have aspx form with several textboxes.They are populated with values from a table via retrieval of a dataview.If the row count for the dataview is 0, then I'd like to reset the values in all textboxes. How can I loop through all the textboxes and set a default value?I've tried the following, but no sucess.

For Each ctrl As Control In Page.Form.Controls
If TypeOf ctrl Is WebControls.TextBox Then
CType(ctrl, WebControls.TextBox).Text = ""
End If
Next

My first For Loop was using Page.Controls but it returned only 1 count.The textboxes are inside a tabpanel (ajax), so do I have to locate the tabpage and then find all it's controls (for each tabpage)?

View 1 Replies

IDE :: Cannot Add Controls To New Forms

Jan 9, 2012

For some reason now, when I start a new project in Visual Basic 2008, I can no longer add any new controls to the forms. All controls are grayed out in the toolbox. What can I check to see what's causing this?

View 1 Replies

Add Controls To A Form In Code And Set The Properties Of The Controls?

May 24, 2009

How can I add controls to a form in code and set the properties of the controls using the With statement?Also I would like to know how to add a container control and then add a control to that container.

View 2 Replies

Controls Not Return All The Child Controls For The Form?

Apr 15, 2010

I have a slight problem With an enumaration of child controls on a form. The following code will not get but about have the controls that are on the form. The controls show that the count is correct but when it goes through the loop it skips over some of the controls. If you run it through the enumeration two or three times it will get all the controls a few at a time. The solution uses two forms, one that has the controls and the other that labels are made and displayed on. The Tx is just a index to add a number to the label.name and rename the label. So each label is identified seperately. This works for all the the controls that are seen in the for each loop.

View 11 Replies

Pass Usercontrol Controls Or Form Controls?

May 11, 2009

I created a class that can take either usercontrol.controls or form.controls as a parameter,how can i pass either to that class? as a property or how?

View 4 Replies

VS 2008 Loop Through Controls Doesn't Get All Controls?

Jan 21, 2011

I am rather irritated at this. I have no clue why looping through controls on a form and in groupboxes leaves out 75% of the controls.

Here's the code I have:

Dim settings As String = ""
Dim gbControl As Control
Dim gbbox As Control

[Code]....

I want to have setting save all settings to an ini file, and not have to reprogram the saving routine when I add a group box or control. At random times, any number of controls can be disabled, checkboxes can be checked and unchecked, radiobuttons can be checked and unchecked. Regardless of the state of the control, I want the control to show up in the loop. But they don't. Only controls that are enabled and only checkboxes that are checked, every other control state is ignored. That's crap, and is definitely not what is needed by any programmer of any type. We're capable of determining if a control is enabled, hidden, checked, visible, and otherwise.

How do I get the controls to be included in the loop regardless of their state?

View 8 Replies

8 Bit GIF - Transparency / Forms And Controls

Apr 3, 2012

I have a 8 bit Gif, that is transparent, with controls sitting on top of it, all in a custom control. This part works fine. However, This control is a menu ring (appears around another control with a few options). The transparent part is over a Picbox, that is in a panel. The transparent part of the image seems to skip the picbox and go right through to the panel. I set the panel to a back color of RED. The custom control when its placed instead of showing the image in the pic box that it is on top of, it shows the RED panel I have made sure all my Z orders are right.

View 5 Replies

Access Another Forms Controls In .NET?

Mar 19, 2010

I'm creating a reporting application, and our customers are going to need to generate some pretty big reports which require quite a bit of memory. Ive been in a re-factoring mood lately, so I was wondering what the best way to access the properties of another open form would be(The reporting viewer opens in a new form.) So far I have:

Dim form As MainSelections
form = My.Application.OpenForms(2)
yay or nay.

*Edit - I should probably mention that what I need is a label, two date time pickers, 5 datagridviews and a few datasets. Those cotrols have the info I use for my parameters

View 2 Replies

Accessing Controls Between Forms?

Sep 4, 2010

I have a thread running on a child form, I want to activate a control on the parent form but cannot. It works fine if It's done from the child forms UI thread:

(FormMain.SetControlPropertyValue(FormMain.RBSQL2005, "Checked", True))

but not from a thread running on the child form:

Public Class FormRestoreDB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t = New Thread(AddressOf UpdateListView1)

[code]....

View 2 Replies

Binding Controls In Win Forms?

Jul 2, 2009

If I load a datatable, and then set a listbox properties pointing to it, I get the right data, e.g.:

[code]...

I get System.Data.DataRowView instead of my actual data.I don't understand how the databinding is actual happening, and how I refresh my the data in the control when the data changes.

View 1 Replies

Forms - Resizing Controls Accordingly

Feb 12, 2011

we all know how to dock or anchor controls so that they resize themselves accordingly when a form is resized. It works fine till we have rows of controls on left and right size of the form. But what if have three columns (Columns as in visual sense. I'm not talking about any column control containing other controls) of controls? For example a form having a bunch of controls in the left side, a bunch in the middle and a bunch in the right. There may be a few more bunches in the middle. Now while resizing the form, I want the controls to resize accordingly as well as change their positions to make space for the previous bunch of controls that are resizing.

I mean, while the user increases the form size horizontally, the controls of the second bunch should resize and at the same time they should move right because the controls of the first bunch are increasing horizontally too. When the user decreases the form size horizontally the same thing should occur in the reverse order. I can manage it somehow using nested split-containers but that's too cumbersome. I would like to know if there's some better way to achieve it, like setting some property etc.?

View 2 Replies

Forms :: DataBinding To Controls?

May 17, 2010

I have a simple UI form with some controls (textboxes, checkboxes, datagridviews etc.)
The form communicates with an object that contains the values that should be displayed in the controls.

View 1 Replies

Forms :: Grouping Controls Using Tag Or Name?

Feb 24, 2010

I am trying to group various controls (of the same type, e.g., labels together, buttons together, etc.) on a form using a tag or a name of some sort so I can identify all those that belong to tag 'A' and those in tag 'B'. In the end I will have on a form a number of labels grouped as tag 'A' and some labels as tag 'B' so I can change their visible properties on/off.

View 4 Replies

Forms :: How To Resize Controls

Sep 1, 2009

im am working on a form with a few textboxes and buttons, the problem is when the form is resized or maximized the controls stay small. If someone could please show me how to resize the controls as the form is being resized.

View 2 Replies

Forms :: Set Controls Properties All At Once?

Jul 4, 2009

is there any way that i can set the property of a control all at once? like for every button, i want their backcolor to be red. something like that.also is it advisable to set the properties of a control in design view rather than code it? does it have any performance issues?

View 3 Replies

Influencing Controls Between Forms?

Mar 31, 2009

I tried rewriting one of my old VB6 projects today. I keep getting stuck. I know that default instancing from VB6 is pretty much gone in VB.net. I have several forms and modules. One form is nothing but a form with a progress bar. When there is certain workload that particular form shows up and displays activity (via progress bar) and then is closes until there is more relevant workload in the app. In VB6, with several of my sub-routines (in my modules) I was able to control the progress bar value by simply referencing it this way: WorkForm.ProgressBar1.Value = (value goes here). This does not work in VB.net since WorkForm itself and any controls on it are considered private. I have tried creating instances of the "WorkForm" via "Dim wForm as New WorkForm", but even then "wForm.ProgressBar1.Value" does not work and I keep getting "'wForm.progressBar1' is not accessible in this context because it is 'Private'."

In fact when I try accessing any control on any form from my various sub-routines all I get is: "is not accessible in this context because it is 'Private'"By the way, is it just me, but after a few days working with .NET framework I realized that it seems pretty web-centric. It seems the whole idea of .NET is to push the apps from the desktop onto the web. I mean, if I rewrote my app to use only a single form up front, I wouldn't be having these problems. But then again, it wouldn't be a desktop app, it would be an app that could be easily embedded into a webpage. Is this the general idea? I am definitely not rewriting my app so it uses only one form. This is a desktop app and multiple forms are necessary.

View 14 Replies

Use The Tag Property Of Controls & Forms?

Dec 14, 2009

Does anybody use the Tag property of controls & forms? If so, what for?

View 6 Replies

Controls On Inherited Forms Moving Around?

Oct 28, 2009

I have setup some base forms with some bottons on it The buttons are situated in a panel.Both the panel and the buttons modifer properties have been set up as "Friend".The problem I have is when I inherit these base forms, the buttons seem to jump around by themselves allot

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved