473,654 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic control creation

i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on
the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye from or
textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll
does not work.

thnkz


Nov 16 '05 #1
17 1754
e-mid.

There are different ways to do that, i have one recomendation.

1. To reach individual controls, access through properties.

example -

protected TextBox mMyTextBox;

public TexBox MyTextBox
{
get {return mMyTextBox;}
}

2. Autoscroll will work even in design mode of form. I am not sure why
its not working for ur form

Shak.
"e-mid" <someone@somewh ere> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl...
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye from or
textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll
does not work.

thnkz

Nov 16 '05 #2
e-mid.

There are different ways to do that, i have one recomendation.

1. To reach individual controls, access through properties.

example -

protected TextBox mMyTextBox;

public TexBox MyTextBox
{
get {return mMyTextBox;}
}

2. Autoscroll will work even in design mode of form. I am not sure why
its not working for ur form

Shak.
"e-mid" <someone@somewh ere> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl...
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye from or
textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll
does not work.

thnkz

Nov 16 '05 #3

"Shakir Hussain" <sh**@fakedomai n.com> wrote in message
news:#j******** ******@tk2msftn gp13.phx.gbl...
e-mid.

There are different ways to do that, i have one recomendation.

1. To reach individual controls, access through properties.

example -

protected TextBox mMyTextBox;

public TexBox MyTextBox
{
get {return mMyTextBox;}
i dont think, this way works. controls created dynamically.
another question arised here , is this controls are private by default?
2. Autoscroll will work even in design mode of form. I am not sure why
its not working for ur form
it scrolls horizontally, but vertical autoscroll does not work..

i did not understand why?
Shak.
"e-mid" <someone@somewh ere> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl...
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control

on
the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye from or textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll does not work.

thnkz


Nov 16 '05 #4

"Shakir Hussain" <sh**@fakedomai n.com> wrote in message
news:#j******** ******@tk2msftn gp13.phx.gbl...
e-mid.

There are different ways to do that, i have one recomendation.

1. To reach individual controls, access through properties.

example -

protected TextBox mMyTextBox;

public TexBox MyTextBox
{
get {return mMyTextBox;}
i dont think, this way works. controls created dynamically.
another question arised here , is this controls are private by default?
2. Autoscroll will work even in design mode of form. I am not sure why
its not working for ur form
it scrolls horizontally, but vertical autoscroll does not work..

i did not understand why?
Shak.
"e-mid" <someone@somewh ere> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl...
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control

on
the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye from or textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll does not work.

thnkz


Nov 16 '05 #5
* "e-mid" <someone@somewh ere> scripsit:
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on
the runtime is useless. what should i do?
\\\
DirectCast(Me.U serControl1.Con trols(12), TextBox).Select (2, 10)
///
another issue is, it is not known how many myUserControls on thye from or
textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll
does not work.


Mhm... It should work...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 16 '05 #6
* "e-mid" <someone@somewh ere> scripsit:
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on
the runtime is useless. what should i do?
\\\
DirectCast(Me.U serControl1.Con trols(12), TextBox).Select (2, 10)
///
another issue is, it is not known how many myUserControls on thye from or
textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll
does not work.


Mhm... It should work...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 16 '05 #7
Herfried, can you explain about this?

DirectCast(Me.U serControl1.Con trols(12), TextBox).Select (2, 10)

and i hear about directCast first time, can you point some sources about it?

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:2k******** *****@uni-berlin.de...
* "e-mid" <someone@somewh ere> scripsit:
i have a user control (say myUserControl) that inherits panel, i create
some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change
name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a control on the runtime is useless. what should i do?


\\\
DirectCast(Me.U serControl1.Con trols(12), TextBox).Select (2, 10)
///
another issue is, it is not known how many myUserControls on thye from or textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll does not work.


Mhm... It should work...

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 16 '05 #8
emid

1. Vertical scrolling will happen only if your controls overflows
vertically. To test this, place controls which overflows horizontally and
vertically. Form will bring both scroll bars.

2. If the controls are created dynamically, to reach individual control, you
have to access Control Collection of your usercontrol

Shak.
"e-mid" <someone@somewh ere> wrote in message
news:eb******** ******@TK2MSFTN GP09.phx.gbl...

"Shakir Hussain" <sh**@fakedomai n.com> wrote in message
news:#j******** ******@tk2msftn gp13.phx.gbl...
e-mid.

There are different ways to do that, i have one recomendation.

1. To reach individual controls, access through properties.

example -

protected TextBox mMyTextBox;

public TexBox MyTextBox
{
get {return mMyTextBox;}
i dont think, this way works. controls created dynamically.
another question arised here , is this controls are private by default?
2. Autoscroll will work even in design mode of form. I am not sure why
its not working for ur form


it scrolls horizontally, but vertical autoscroll does not work..

i did not understand why?
Shak.
"e-mid" <someone@somewh ere> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl...
i have a user control (say myUserControl) that inherits panel, i create some textboxes on myUserControl dynamically, then i create some
myUserControls on the form dynamically with a loop . of course i change name,location etc.. meanwhile.

i have some problems here then.

eg: how could i reach each myUserControl and textBoxes on this
myUserControl.
it could be betterif i reach them directly, i know renaming a
control on
the runtime is useless. what should i do?
another issue is, it is not known how many myUserControls on thye

from or textboxes on a myUserControl will be created. i need autoscroll
functionality. on the panel it works, but on the form it seems, autoscroll does not work.

thnkz



Nov 16 '05 #9
* "e-mid" <someone@somewh ere> scripsit:
Herfried, can you explain about this?

DirectCast(Me.U serControl1.Con trols(12), TextBox).Select (2, 10)

and i hear about directCast first time, can you point some sources about it?


The 'Controls' collection contains objects of type 'Control'. 'Control'
is the generic type for controls shown on Windows Forms. In order to
access members of an object that is an instance of a class that inherits
from 'Control', you need to cast the object to this class.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 16 '05 #10

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

Similar topics

3
4771
by: Eddie de Bear | last post by:
Hi, A project I am working on has a requirement for dynamic menus. For the most part this works really well. The menus I'm creating a based on files and directories, so naturally the menu creation takes some time. The approach I took was to override the OnSelect method of the MenuItem class, which had code to populate the
2
16239
by: charliewest | last post by:
I need to create textboxes in real-time, the actual number of which is determine by a result from a database query. I have been able to create the controls, and then add them to the ASPX page. However, when i submit the page, i am unable to read the values entered in these new textboxes. I have first tried to use System.Web.UI.WebControls.TextBox namespace, however, i was unable to read any value from my textboxes using the following...
2
2548
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired and are called like a static control. Here is the problem that I need to solve. The processing overhead that occurs to determine what dynamic controls need to be added involves business logic and a query or queries of data in a sql server...
4
2694
by: spx27 | last post by:
Does anyone know the best way to handle passing a dynamic menu generated from a login from one asp.net page to another. Would it be better to recreate the menu on each page? Save the menu as a string into a session variable upon login? Any other way to do this I may be missing? This menu is part of an intranet. The user logs in, checks SQL database for folder permissions, then scans web directories for all folders which match permissions...
1
1200
by: Homam | last post by:
So I have a composite paging control that shoulld be positioned on the page like this: PagNav ResultSetDisplay PagNav I know that I can't resuse the PagNav more than once in the form, so I instantiate a couple of instances, PagNavTop and PagNavBottom, and thus I end up with:
3
1705
by: vodafone | last post by:
Hy all I've a little problem. I need to write a dynamic page that render control according to validation status return from previous control validation status. To be clear, I've page that starts requesting some info, then user press a button, and the same page should show the new field only if validation returns true. But it sounds not so simple to do.
0
1579
by: Prodip K Saha | last post by:
Many Programmers stay away from loading User Control dynamically on the Web Form because of the complexity associated with it's state management and event handling. It is easy to load a User Control dynamically once you understand the ASP.Net page creation model. In this article, I would like to show you how easy it is to implement the dynamic creation of User Control if you simply do it in the correct way. Let the ASP.Net take care of the...
0
1131
by: Paul | last post by:
Hi! I have been wondering about a design issue for some time now and hope someone can help sort this one out for me. Say you have to create some webcontrols dynamically. Each controls creation is dependent on another’s selected value. That is, you can’t create control B if you don’t know the value of control A. There is no problem this far. I’ve done some testing and if I always create the control in Page_Init, ASP.NET has...
13
10162
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his first order. Likewise if he clicks the second LinkButton, he will be shown the details of the second order he had placed. The Text of the LinkButtons will be 1 2 3 etc. So this user would see 1 2 3 4 5 as the LinkButtons. The problem is...
1
4887
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to another page in the same domain which also contains infragistics datagid populated with default data retrieved from Data Base. After creating the frame I am attaching it to the HTML DOM and show it as modal popup with OK and Cancel Button inside an...
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8708
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.