473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Controls in a form

My problem is to scroll all the controls in a form. The
problem is: If there are controls that contains still
others controls, that contains still others controls ecc...
how can i write an iteractive procedure to scroll all the
controls in the form?

Thank you so much
Alessandro Rossi
Nov 15 '05 #1
4 10209
Hi Alessandro,

You should have no problem with that, I just did a test, if a control is
contained inside another control then its position is relative to its
parent, therefore when the parent is moved it will relocated.
I tried this:
In a form I placed a panel, inside the panel two buttons and one textbox,
when I change the Top property of the Panel containing the other controls
they scroll as expected.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Alessandro Rossi" <al**************@areaitsrl.com> wrote in message
news:0a****************************@phx.gbl...
My problem is to scroll all the controls in a form. The
problem is: If there are controls that contains still
others controls, that contains still others controls ecc...
how can i write an iteractive procedure to scroll all the
controls in the form?

Thank you so much
Alessandro Rossi

Nov 15 '05 #2
Maybe i've wrong to explain...
My problem is scroll the controls in a form, not move the
controls. If i write this code:
foreach (Control ctr in form1.Controls)
{
Dosomething
}

are examinated all the controls that had parent "Form1".
If in the form1 there is, for example, a panel with inside
others textboxes, these are not examinated because their
parent is the panel.

Thank you
Alessandro Rossi

Nov 15 '05 #3
Alessandro,

I still do not catch you, you say that you want to scroll the controls,
what do you mean with "scroll the controls" ?
An scroll action IS a move action, where you move the content of the
scrolled area up/down or right/left depending of the scroll movement.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Alessandro Rossi" <al**************@areaitsrl.com> wrote in message
news:0f****************************@phx.gbl...
Maybe i've wrong to explain...
My problem is scroll the controls in a form, not move the
controls. If i write this code:
foreach (Control ctr in form1.Controls)
{
Dosomething
}

are examinated all the controls that had parent "Form1".
If in the form1 there is, for example, a panel with inside
others textboxes, these are not examinated because their
parent is the panel.

Thank you
Alessandro Rossi

Nov 15 '05 #4
Haa :)

Ok, basically what you can do is iterate in the Controls collection, and for
each Control see if that control's Controls has elements, if so iterate on
it, see that I'm making a deep first traversal, if you need a wide first you
will need a queue.

Here is the code for it:
void IterateControl(System.Windows.Forms.Control.Contro lCollection
controls )

{

foreach(Control control in controls)

{

if ( control.Controls.Count > 0 )

IterateControl( control.Controls);

//do something with the control.

MessageBox.Show( control.Name);

}

}

private void button2_Click(object sender, System.EventArgs e)

{

IterateControl( Controls);

}

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Alessandro Rossi" <al**************@areaitsrl.com> wrote in message
news:0e****************************@phx.gbl...
Sorry, I have mistaken, my english had some problems :),
i've changed the word "loop" with "scroll"...

Sorry...
Alessandro Rossi

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at...
7
by: Saintor | last post by:
What I do now is I put a value in the tag property, and using the form_current event, I run through all controls properties until the ones with the required tag value are met. Sound OK in theory,...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
3
by: Roger | last post by:
Hi In a Windows forms application I have 2 forms A and B; Form B inherits from form A. Form A is never displayed and its only purpose is to be inherited from and therefore contains mostly...
10
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a...
22
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.