473,378 Members | 1,378 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,378 software developers and data experts.

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 1508
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*************@TK2MSFTNGP02.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.public.dotnet.languages.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**************@TK2MSFTNGP02.phx.gbl...
thanks for your reply

the development based on vb.net2005 + winform


----- Original Message -----
From: "Cor Ligthert [MVP]" <no************@planet.nl>
Newsgroups: microsoft.public.dotnet.languages.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(lbl(i))) Then
me.Controls.Remove(lbl(i))
End If

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.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****************@TK2MSFTNGP02.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(lbl(i))) Then
me.Controls.Remove(lbl(i))
End If

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.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
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...
4
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...
4
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...
0
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...
9
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...
3
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...
3
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. ...
3
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...
6
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.