473,729 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About Adding controls dynamically

hello

i want to add some controls in according of the time.
but when the time change, i call the method again to add controls again,No
effect!
i think maybe i should unload the controls adding before,how can i unload
it??

pls help me,thanks

Aug 7 '06 #1
6 1525
Crazyjh,

For using dynamic controls it is important to know if it is about a webpage
or a winform. They act completely different in this, so let us know that to
make the answers not only confusing.

Cor

"crazyjh" <cr*****@gmail. comschreef in bericht
news:eU******** *****@TK2MSFTNG P02.phx.gbl...
hello

i want to add some controls in according of the time.
but when the time change, i call the method again to add controls again,No
effect!
i think maybe i should unload the controls adding before,how can i unload
it??

pls help me,thanks

Aug 7 '06 #2
thanks for your reply

the development based on vb.net2005 + winform


----- Original Message -----
From: "Cor Ligthert [MVP]" <no************ @planet.nl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vb
Sent: Monday, August 07, 2006 6:09 PM
Subject: Re: About Adding controls dynamically
| Crazyjh,
|
| For using dynamic controls it is important to know if it is about a
webpage
| or a winform. They act completely different in this, so let us know that
to
| make the answers not only confusing.
|
| Cor
|

Aug 7 '06 #3
Crazyjh,

The oposite from adding a control is the control.remove
http://msdn2.microsoft.com/en-us/lib...on.remove.aspx

I hope this helps,

Cor
"crazyjh" <cr*****@gmail. comschreef in bericht
news:Ok******** ******@TK2MSFTN GP02.phx.gbl...
thanks for your reply

the development based on vb.net2005 + winform


----- Original Message -----
From: "Cor Ligthert [MVP]" <no************ @planet.nl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vb
Sent: Monday, August 07, 2006 6:09 PM
Subject: Re: About Adding controls dynamically
| Crazyjh,
|
| For using dynamic controls it is important to know if it is about a
webpage
| or a winform. They act completely different in this, so let us know that
to
| make the answers not only confusing.
|
| Cor
|

Aug 7 '06 #4
"crazyjh" <cr*****@gmail. comschrieb:
i want to add some controls in according of the time.
but when the time change, i call the method again to add controls again,No
effect!
i think maybe i should unload the controls adding before,how can i unload
it??
You can remove the control from the container's (form, control) 'Controls'
collection.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Aug 7 '06 #5
thanks

i used the sentences below,it appearly doesn't work! lbl is dynamic added in
a function a,next time when i called a,the "if" statement don't work at all

dim lbl(i) as label
lbl(i) = new label
If (me.Contains(lb l(i))) Then
me.Controls.Rem ove(lbl(i))
End If

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
| Crazyjh,
|
| The oposite from adding a control is the control.remove
|
http://msdn2.microsoft.com/en-us/lib...on.remove.aspx
|
| I hope this helps,
|
| Cor
|

Aug 7 '06 #6
crazyjh,

You have to remove the original added control. This lbl(i) is a complete new
label that is never in your control collection as long as you don't add it.

You can as well use the removeAt.
http://msdn2.microsoft.com/en-us/lib....removeat.aspx

Be aware that this reindexes the index.

Cor

"crazyjh" <cr*****@gmail. comschreef in bericht
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
thanks

i used the sentences below,it appearly doesn't work! lbl is dynamic added
in
a function a,next time when i called a,the "if" statement don't work at
all

dim lbl(i) as label
lbl(i) = new label
If (me.Contains(lb l(i))) Then
me.Controls.Rem ove(lbl(i))
End If

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
| Crazyjh,
|
| The oposite from adding a control is the control.remove
|
http://msdn2.microsoft.com/en-us/lib...on.remove.aspx
|
| I hope this helps,
|
| Cor
|

Aug 7 '06 #7

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

Similar topics

3
1703
by: Punisher | last post by:
I'm adding checkbox controls to a table dynamically when the form loads for the first time. When a postback occurs, the controls are not maintained in the table. How do I get them to retain without having re-add them again.
4
5482
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
4
2497
by: Bas Groeneveld | last post by:
I am developing an ASP.NET application part of which consists of a data entry wizard defined by entries in a data table - ie the controls on each page of the wizard are determined by definitions in the table. I know that I can dynamically add controls (eg a textbox) to the page controls collection of a web form in a server event which will then be rendered onto the form, as in the following snippet: System.Web.UI.WebControls.TextBox...
0
1873
by: Sileesh | last post by:
Hi I have html table and a Button in an Aspx page. I am adding one row with some textboxes to Html table each time i click on the Button thru Javascript. Now problem is when when i try to collect the data in the Textboxes which i added dynamically from server side, i am not able to do . Alos i tried to bedug, the total no of rows in Html table does not reflect the dynamically added rows.
9
2781
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE. Or, to be more precise, why it is impossible to have an onClick sub respond to that button’s Click event. My main page has only one line:
3
2127
by: Bart Van Hemelen | last post by:
I'm working on a project where the user of a site will receive custom content, depending on a set of parameters. The content will all be contained in UserControls (.ascx), that will be used as webparts on a page. We need to add the webparts dynamically to the site, depending on the status of the user: this involves a personalisation of a travel website, so a user can be "before" a trip, "during" a trip and "after" a trip, and depending...
3
2195
by: Ben Dewey | last post by:
Okay, so I have a base Page class called ArticlesPageBase. This base class has reads in an overridable ArticleId and Loads the data into a Panel object in the ContentPlaceHolder of the Master. The article that it loads from the Database is a xml field that contains html code for the article. I added some custom html to the database article called <question id="22" /> When the article contains inline questions are parse out the start...
3
5489
by: Mark Denardo | last post by:
I'm trying to dynamically create and add controls to a web page: Label obj1 = new Label(); DropDownList obj2 = new DropDownList(); Controls.Add(obj1); Controls.Add(obj2); But I get the following error when the DDL is added (but not the Label): "Control 'ctl07' of type 'DropDownList' must be placed inside a form tag
6
11081
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
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
9142
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
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
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.