Connecting Tech Pros Worldwide Forums | Help | Site Map

Serious discussion about removing dynamically controls

Cor
Guest
 
Posts: n/a
#1: Nov 20 '05
Hi,
I start a new thread about a discussion from yesterday (or for some of us
this morning). It was a not so nice discussion about dynamically removing
controls from a panel or what ever.
It started by an example from me, that was far from complete and with typing
errors, but basically it had the meaning to show that removing controls
reversible was the nicest method.

This was a lets say conclusion (but what is that in a newsgroup) in a
discussion some weeks ago in this newsgroup. The method was contributed by
Armin. I found it brilliant and since that time I call this the method
Armin.

Jack did totally disagree with this method and did after a while contribute
some code.

Therefore I send both code's to this newsgroup in this new thread. I think
it is good to talk professionally about it. So it is not the code Cor, Nick,
Armin or Jack. Just the method "reverse For next loop", against the "While
end while loop" for removing controls dynamically.

I don't want to start with my + of - points about the methods, maybe I will
give that, but I hope that it will come automatically in this newsgroup

The code that Jack has given some contribution for me, because I did not
know "removeAT" exist. But I always do the things that I do plus in the same
way minus. So I doubt if I will use it, but for the example I did use
"removeAT" (I think it is nicer). Please don't start a discussion about
that. The question is the "While end while" against reversal "For next".

"While end While"
Dim idx As Integer
idx = 0
While idx < Me.Panel1.Controls.Count ' while in bounds
If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
Me.Panel1.Controls.RemoveAt(idx)
Else
idx = idx + 1 ' otherwise advance to next control
End If
End While
-----------------
"For index Next reversal"
Dim idx As Integer
For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
Me.Panel1.Controls.RemoveAt(idx)
End If
Next
I hope this contribute something
Cor





One Handed Man
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Serious discussion about removing dynamically controls


I favour the reversal code which I tend to use a lot because it's cleaner
and generally saves you getting into problems.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"Cor" <non@non.com> wrote in message
news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...[color=blue]
> Hi,
> I start a new thread about a discussion from yesterday (or for some of us
> this morning). It was a not so nice discussion about dynamically removing
> controls from a panel or what ever.
> It started by an example from me, that was far from complete and with[/color]
typing[color=blue]
> errors, but basically it had the meaning to show that removing controls
> reversible was the nicest method.
>
> This was a lets say conclusion (but what is that in a newsgroup) in a
> discussion some weeks ago in this newsgroup. The method was contributed by
> Armin. I found it brilliant and since that time I call this the method
> Armin.
>
> Jack did totally disagree with this method and did after a while[/color]
contribute[color=blue]
> some code.
>
> Therefore I send both code's to this newsgroup in this new thread. I think
> it is good to talk professionally about it. So it is not the code Cor,[/color]
Nick,[color=blue]
> Armin or Jack. Just the method "reverse For next loop", against the "While
> end while loop" for removing controls dynamically.
>
> I don't want to start with my + of - points about the methods, maybe I[/color]
will[color=blue]
> give that, but I hope that it will come automatically in this newsgroup
>
> The code that Jack has given some contribution for me, because I did not
> know "removeAT" exist. But I always do the things that I do plus in the[/color]
same[color=blue]
> way minus. So I doubt if I will use it, but for the example I did use
> "removeAT" (I think it is nicer). Please don't start a discussion about
> that. The question is the "While end while" against reversal "For next".
>
> "While end While"
> Dim idx As Integer
> idx = 0
> While idx < Me.Panel1.Controls.Count ' while in bounds
> If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> Me.Panel1.Controls.RemoveAt(idx)
> Else
> idx = idx + 1 ' otherwise advance to next control
> End If
> End While
> -----------------
> "For index Next reversal"
> Dim idx As Integer
> For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
> If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> Me.Panel1.Controls.RemoveAt(idx)
> End If
> Next
> I hope this contribute something
> Cor
>
>
>
>[/color]


Charles Law
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Serious discussion about removing dynamically controls


ACK (that's me pretending to be Herfried ... I wish)

The only thing I would probably change is

Do While ... Loop

instead of what is essentially a While ... Wend loop.

Charles


"One Handed Man" <terry_burnsREMOVE%FOR%NO%SPAM@BTOpenworld.com> wrote in
message news:urMETZ4cDHA.1828@TK2MSFTNGP10.phx.gbl...[color=blue]
> I favour the reversal code which I tend to use a lot because it's cleaner
> and generally saves you getting into problems.
>
> --
> Regards - One Handed Man
>
> Author : Fish .NET & Keep .NET
> =========================================
> This posting is provided "AS IS" with no warranties,
> and confers no rights.
>
>
> "Cor" <non@non.com> wrote in message
> news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...[color=green]
> > Hi,
> > I start a new thread about a discussion from yesterday (or for some of[/color][/color]
us[color=blue][color=green]
> > this morning). It was a not so nice discussion about dynamically[/color][/color]
removing[color=blue][color=green]
> > controls from a panel or what ever.
> > It started by an example from me, that was far from complete and with[/color]
> typing[color=green]
> > errors, but basically it had the meaning to show that removing controls
> > reversible was the nicest method.
> >
> > This was a lets say conclusion (but what is that in a newsgroup) in a
> > discussion some weeks ago in this newsgroup. The method was contributed[/color][/color]
by[color=blue][color=green]
> > Armin. I found it brilliant and since that time I call this the method
> > Armin.
> >
> > Jack did totally disagree with this method and did after a while[/color]
> contribute[color=green]
> > some code.
> >
> > Therefore I send both code's to this newsgroup in this new thread. I[/color][/color]
think[color=blue][color=green]
> > it is good to talk professionally about it. So it is not the code Cor,[/color]
> Nick,[color=green]
> > Armin or Jack. Just the method "reverse For next loop", against the[/color][/color]
"While[color=blue][color=green]
> > end while loop" for removing controls dynamically.
> >
> > I don't want to start with my + of - points about the methods, maybe I[/color]
> will[color=green]
> > give that, but I hope that it will come automatically in this newsgroup
> >
> > The code that Jack has given some contribution for me, because I did not
> > know "removeAT" exist. But I always do the things that I do plus in the[/color]
> same[color=green]
> > way minus. So I doubt if I will use it, but for the example I did use
> > "removeAT" (I think it is nicer). Please don't start a discussion about
> > that. The question is the "While end while" against reversal "For next".
> >
> > "While end While"
> > Dim idx As Integer
> > idx = 0
> > While idx < Me.Panel1.Controls.Count ' while in bounds
> > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > Me.Panel1.Controls.RemoveAt(idx)
> > Else
> > idx = idx + 1 ' otherwise advance to next control
> > End If
> > End While
> > -----------------
> > "For index Next reversal"
> > Dim idx As Integer
> > For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
> > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > Me.Panel1.Controls.RemoveAt(idx)
> > End If
> > Next
> > I hope this contribute something
> > Cor
> >
> >
> >
> >[/color]
>
>[/color]


Stephany Young
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Serious discussion about removing dynamically controls


Time for my 2 pen'orth.

The first thing I need to say is that there is no right or wrong way. What
ever achieves your objective and suits your development style is right for
you.

That said, some ways of doing things tend to be better that other ways in
terms of performance, resource usage etc, but, with some of the advanced
specification of hardware these days, a few milliseconds here and there or a
few KB of menory here or there may not be your biggest concern.

The way I tend to work is to to use the power of the tools as far as I can.

Taking your first example, the problem can be demonstrated thus:

Me.Panel1.Controls
Item 0 = Label1 As Label
Item 1 = Label2 As Label
Item 2 = Label3 As Label

The first thing that is happening is that you are manually maintaing an
index counter. This is a probably performance matter compared to a loop
control variable.

On the first iteration of the loop, idx=0, Me.Panel1.Controls.Count=3 and
TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label1), so
the first item is removed and the collection now comprises:

Me.Panel1.Controls
Item 0 = Label2 As Label
Item 1 = Label3 As Label

On the second iteration of the loop, idx=0, Me.Panel1.Controls.Count=2 and
TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2), so
the first item is removed and the collection now comprises:

Me.Panel1.Controls
Item 0 = Label3 As Label

On the third iteration of the loop, idx=0, Me.Panel1.Controls.Count=1 and
TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2), so
the first item is removed and the collection now comprises:

Me.Panel1.Controls

On the forth iteration of the loop, idx=0, Me.Panel1.Controls.Count=0 and so
the iteration is not executed.

Notice that idx has not been modified so the code that manually maintains
the index counter is redundant. If one if the controls wasn't a Label then
idx would have been modified but the code still had to execute the idx = idx
+ 1. (This could simplified to idx += 1).

Taking the second example, there is no manually maintained index counter -
instead, the indexing is controlled by the loop control variable. Because
the collection is being walked backwards there is no need for the idx = idx
+ 1 and, in my view the process is cleaner and 'should be' more efficient.
It could still be simplified thus:

For idx as Integer = Me.Panel1.Controls.Count - 1 To 0 Step -1
If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
Me.Panel1.Controls.RemoveAt(idx)
Next

It might be interesting, for someone who is so inclined, to compare the
resulting IL code for the 2 methodologies and see if one is more efficient
than the other or if they produce the same IL code.

Please excuse any typos or trivial coding errors.

"Cor" <non@non.com> wrote in message
news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...[color=blue]
> Hi,
> I start a new thread about a discussion from yesterday (or for some of us
> this morning). It was a not so nice discussion about dynamically removing
> controls from a panel or what ever.
> It started by an example from me, that was far from complete and with[/color]
typing[color=blue]
> errors, but basically it had the meaning to show that removing controls
> reversible was the nicest method.
>
> This was a lets say conclusion (but what is that in a newsgroup) in a
> discussion some weeks ago in this newsgroup. The method was contributed by
> Armin. I found it brilliant and since that time I call this the method
> Armin.
>
> Jack did totally disagree with this method and did after a while[/color]
contribute[color=blue]
> some code.
>
> Therefore I send both code's to this newsgroup in this new thread. I think
> it is good to talk professionally about it. So it is not the code Cor,[/color]
Nick,[color=blue]
> Armin or Jack. Just the method "reverse For next loop", against the "While
> end while loop" for removing controls dynamically.
>
> I don't want to start with my + of - points about the methods, maybe I[/color]
will[color=blue]
> give that, but I hope that it will come automatically in this newsgroup
>
> The code that Jack has given some contribution for me, because I did not
> know "removeAT" exist. But I always do the things that I do plus in the[/color]
same[color=blue]
> way minus. So I doubt if I will use it, but for the example I did use
> "removeAT" (I think it is nicer). Please don't start a discussion about
> that. The question is the "While end while" against reversal "For next".
>
> "While end While"
> Dim idx As Integer
> idx = 0
> While idx < Me.Panel1.Controls.Count ' while in bounds
> If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> Me.Panel1.Controls.RemoveAt(idx)
> Else
> idx = idx + 1 ' otherwise advance to next control
> End If
> End While
> -----------------
> "For index Next reversal"
> Dim idx As Integer
> For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
> If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> Me.Panel1.Controls.RemoveAt(idx)
> End If
> Next
> I hope this contribute something
> Cor
>
>
>
>[/color]


One Handed Man
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Serious discussion about removing dynamically controls


Yes, there will probably be tiny performance differences between the two,
and when dealing with a huge collection, it might be worth looking at.

I personally prefer to see the
Dim idx as Integer = 0 before the loop, it makes it stand out more

and more inportantly.

When you traverse forward through a collection as in scenario one, its easy
to miss out that conditional increment which has bitten me a couple of times
in the past.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"Stephany Young" <stephany@sysoft.co.nz> wrote in message
news:%23c2Q%2324cDHA.372@TK2MSFTNGP11.phx.gbl...[color=blue]
> Time for my 2 pen'orth.
>
> The first thing I need to say is that there is no right or wrong way. What
> ever achieves your objective and suits your development style is right for
> you.
>
> That said, some ways of doing things tend to be better that other ways in
> terms of performance, resource usage etc, but, with some of the advanced
> specification of hardware these days, a few milliseconds here and there or[/color]
a[color=blue]
> few KB of menory here or there may not be your biggest concern.
>
> The way I tend to work is to to use the power of the tools as far as I[/color]
can.[color=blue]
>
> Taking your first example, the problem can be demonstrated thus:
>
> Me.Panel1.Controls
> Item 0 = Label1 As Label
> Item 1 = Label2 As Label
> Item 2 = Label3 As Label
>
> The first thing that is happening is that you are manually maintaing an
> index counter. This is a probably performance matter compared to a loop
> control variable.
>
> On the first iteration of the loop, idx=0, Me.Panel1.Controls.Count=3 and
> TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label1), so
> the first item is removed and the collection now comprises:
>
> Me.Panel1.Controls
> Item 0 = Label2 As Label
> Item 1 = Label3 As Label
>
> On the second iteration of the loop, idx=0, Me.Panel1.Controls.Count=2 and
> TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2), so
> the first item is removed and the collection now comprises:
>
> Me.Panel1.Controls
> Item 0 = Label3 As Label
>
> On the third iteration of the loop, idx=0, Me.Panel1.Controls.Count=1 and
> TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2), so
> the first item is removed and the collection now comprises:
>
> Me.Panel1.Controls
>
> On the forth iteration of the loop, idx=0, Me.Panel1.Controls.Count=0 and[/color]
so[color=blue]
> the iteration is not executed.
>
> Notice that idx has not been modified so the code that manually maintains
> the index counter is redundant. If one if the controls wasn't a Label then
> idx would have been modified but the code still had to execute the idx =[/color]
idx[color=blue]
> + 1. (This could simplified to idx += 1).
>
> Taking the second example, there is no manually maintained index counter -
> instead, the indexing is controlled by the loop control variable. Because
> the collection is being walked backwards there is no need for the idx =[/color]
idx[color=blue]
> + 1 and, in my view the process is cleaner and 'should be' more efficient.
> It could still be simplified thus:
>
> For idx as Integer = Me.Panel1.Controls.Count - 1 To 0 Step -1
> If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> Me.Panel1.Controls.RemoveAt(idx)
> Next
>
> It might be interesting, for someone who is so inclined, to compare the
> resulting IL code for the 2 methodologies and see if one is more efficient
> than the other or if they produce the same IL code.
>
> Please excuse any typos or trivial coding errors.
>
> "Cor" <non@non.com> wrote in message
> news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...[color=green]
> > Hi,
> > I start a new thread about a discussion from yesterday (or for some of[/color][/color]
us[color=blue][color=green]
> > this morning). It was a not so nice discussion about dynamically[/color][/color]
removing[color=blue][color=green]
> > controls from a panel or what ever.
> > It started by an example from me, that was far from complete and with[/color]
> typing[color=green]
> > errors, but basically it had the meaning to show that removing controls
> > reversible was the nicest method.
> >
> > This was a lets say conclusion (but what is that in a newsgroup) in a
> > discussion some weeks ago in this newsgroup. The method was contributed[/color][/color]
by[color=blue][color=green]
> > Armin. I found it brilliant and since that time I call this the method
> > Armin.
> >
> > Jack did totally disagree with this method and did after a while[/color]
> contribute[color=green]
> > some code.
> >
> > Therefore I send both code's to this newsgroup in this new thread. I[/color][/color]
think[color=blue][color=green]
> > it is good to talk professionally about it. So it is not the code Cor,[/color]
> Nick,[color=green]
> > Armin or Jack. Just the method "reverse For next loop", against the[/color][/color]
"While[color=blue][color=green]
> > end while loop" for removing controls dynamically.
> >
> > I don't want to start with my + of - points about the methods, maybe I[/color]
> will[color=green]
> > give that, but I hope that it will come automatically in this newsgroup
> >
> > The code that Jack has given some contribution for me, because I did not
> > know "removeAT" exist. But I always do the things that I do plus in the[/color]
> same[color=green]
> > way minus. So I doubt if I will use it, but for the example I did use
> > "removeAT" (I think it is nicer). Please don't start a discussion about
> > that. The question is the "While end while" against reversal "For next".
> >
> > "While end While"
> > Dim idx As Integer
> > idx = 0
> > While idx < Me.Panel1.Controls.Count ' while in bounds
> > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > Me.Panel1.Controls.RemoveAt(idx)
> > Else
> > idx = idx + 1 ' otherwise advance to next control
> > End If
> > End While
> > -----------------
> > "For index Next reversal"
> > Dim idx As Integer
> > For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
> > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > Me.Panel1.Controls.RemoveAt(idx)
> > End If
> > Next
> > I hope this contribute something
> > Cor
> >
> >
> >
> >[/color]
>
>[/color]


One Handed Man
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Serious discussion about removing dynamically controls


Sorry, I meant

Dim idx as Integer 'before the loop, it makes it stand out more

not . .
[color=blue]
> Dim idx as Integer = 0 before the loop, it makes it stand out more[/color]

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"One Handed Man" <terry_burnsREMOVE%FOR%NO%SPAM@BTOpenworld.com> wrote in
message news:eJhqU%234cDHA.1280@tk2msftngp13.phx.gbl...[color=blue]
> Yes, there will probably be tiny performance differences between the two,
> and when dealing with a huge collection, it might be worth looking at.
>
> I personally prefer to see the
> Dim idx as Integer = 0 before the loop, it makes it stand out more
>
> and more inportantly.
>
> When you traverse forward through a collection as in scenario one, its[/color]
easy[color=blue]
> to miss out that conditional increment which has bitten me a couple of[/color]
times[color=blue]
> in the past.
>
> --
> Regards - One Handed Man
>
> Author : Fish .NET & Keep .NET
> =========================================
> This posting is provided "AS IS" with no warranties,
> and confers no rights.
>
>
> "Stephany Young" <stephany@sysoft.co.nz> wrote in message
> news:%23c2Q%2324cDHA.372@TK2MSFTNGP11.phx.gbl...[color=green]
> > Time for my 2 pen'orth.
> >
> > The first thing I need to say is that there is no right or wrong way.[/color][/color]
What[color=blue][color=green]
> > ever achieves your objective and suits your development style is right[/color][/color]
for[color=blue][color=green]
> > you.
> >
> > That said, some ways of doing things tend to be better that other ways[/color][/color]
in[color=blue][color=green]
> > terms of performance, resource usage etc, but, with some of the advanced
> > specification of hardware these days, a few milliseconds here and there[/color][/color]
or[color=blue]
> a[color=green]
> > few KB of menory here or there may not be your biggest concern.
> >
> > The way I tend to work is to to use the power of the tools as far as I[/color]
> can.[color=green]
> >
> > Taking your first example, the problem can be demonstrated thus:
> >
> > Me.Panel1.Controls
> > Item 0 = Label1 As Label
> > Item 1 = Label2 As Label
> > Item 2 = Label3 As Label
> >
> > The first thing that is happening is that you are manually maintaing an
> > index counter. This is a probably performance matter compared to a loop
> > control variable.
> >
> > On the first iteration of the loop, idx=0, Me.Panel1.Controls.Count=3[/color][/color]
and[color=blue][color=green]
> > TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label1),[/color][/color]
so[color=blue][color=green]
> > the first item is removed and the collection now comprises:
> >
> > Me.Panel1.Controls
> > Item 0 = Label2 As Label
> > Item 1 = Label3 As Label
> >
> > On the second iteration of the loop, idx=0, Me.Panel1.Controls.Count=2[/color][/color]
and[color=blue][color=green]
> > TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2),[/color][/color]
so[color=blue][color=green]
> > the first item is removed and the collection now comprises:
> >
> > Me.Panel1.Controls
> > Item 0 = Label3 As Label
> >
> > On the third iteration of the loop, idx=0, Me.Panel1.Controls.Count=1[/color][/color]
and[color=blue][color=green]
> > TypeOf Me.Panel1.Controls.Item(idx) Is Label equates to True (Label2),[/color][/color]
so[color=blue][color=green]
> > the first item is removed and the collection now comprises:
> >
> > Me.Panel1.Controls
> >
> > On the forth iteration of the loop, idx=0, Me.Panel1.Controls.Count=0[/color][/color]
and[color=blue]
> so[color=green]
> > the iteration is not executed.
> >
> > Notice that idx has not been modified so the code that manually[/color][/color]
maintains[color=blue][color=green]
> > the index counter is redundant. If one if the controls wasn't a Label[/color][/color]
then[color=blue][color=green]
> > idx would have been modified but the code still had to execute the idx =[/color]
> idx[color=green]
> > + 1. (This could simplified to idx += 1).
> >
> > Taking the second example, there is no manually maintained index[/color][/color]
counter -[color=blue][color=green]
> > instead, the indexing is controlled by the loop control variable.[/color][/color]
Because[color=blue][color=green]
> > the collection is being walked backwards there is no need for the idx =[/color]
> idx[color=green]
> > + 1 and, in my view the process is cleaner and 'should be' more[/color][/color]
efficient.[color=blue][color=green]
> > It could still be simplified thus:
> >
> > For idx as Integer = Me.Panel1.Controls.Count - 1 To 0 Step -1
> > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > Me.Panel1.Controls.RemoveAt(idx)
> > Next
> >
> > It might be interesting, for someone who is so inclined, to compare the
> > resulting IL code for the 2 methodologies and see if one is more[/color][/color]
efficient[color=blue][color=green]
> > than the other or if they produce the same IL code.
> >
> > Please excuse any typos or trivial coding errors.
> >
> > "Cor" <non@non.com> wrote in message
> > news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...[color=darkred]
> > > Hi,
> > > I start a new thread about a discussion from yesterday (or for some of[/color][/color]
> us[color=green][color=darkred]
> > > this morning). It was a not so nice discussion about dynamically[/color][/color]
> removing[color=green][color=darkred]
> > > controls from a panel or what ever.
> > > It started by an example from me, that was far from complete and with[/color]
> > typing[color=darkred]
> > > errors, but basically it had the meaning to show that removing[/color][/color][/color]
controls[color=blue][color=green][color=darkred]
> > > reversible was the nicest method.
> > >
> > > This was a lets say conclusion (but what is that in a newsgroup) in a
> > > discussion some weeks ago in this newsgroup. The method was[/color][/color][/color]
contributed[color=blue]
> by[color=green][color=darkred]
> > > Armin. I found it brilliant and since that time I call this the method
> > > Armin.
> > >
> > > Jack did totally disagree with this method and did after a while[/color]
> > contribute[color=darkred]
> > > some code.
> > >
> > > Therefore I send both code's to this newsgroup in this new thread. I[/color][/color]
> think[color=green][color=darkred]
> > > it is good to talk professionally about it. So it is not the code Cor,[/color]
> > Nick,[color=darkred]
> > > Armin or Jack. Just the method "reverse For next loop", against the[/color][/color]
> "While[color=green][color=darkred]
> > > end while loop" for removing controls dynamically.
> > >
> > > I don't want to start with my + of - points about the methods, maybe I[/color]
> > will[color=darkred]
> > > give that, but I hope that it will come automatically in this[/color][/color][/color]
newsgroup[color=blue][color=green][color=darkred]
> > >
> > > The code that Jack has given some contribution for me, because I did[/color][/color][/color]
not[color=blue][color=green][color=darkred]
> > > know "removeAT" exist. But I always do the things that I do plus in[/color][/color][/color]
the[color=blue][color=green]
> > same[color=darkred]
> > > way minus. So I doubt if I will use it, but for the example I did use
> > > "removeAT" (I think it is nicer). Please don't start a discussion[/color][/color][/color]
about[color=blue][color=green][color=darkred]
> > > that. The question is the "While end while" against reversal "For[/color][/color][/color]
next".[color=blue][color=green][color=darkred]
> > >
> > > "While end While"
> > > Dim idx As Integer
> > > idx = 0
> > > While idx < Me.Panel1.Controls.Count ' while in bounds
> > > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > > Me.Panel1.Controls.RemoveAt(idx)
> > > Else
> > > idx = idx + 1 ' otherwise advance to next control
> > > End If
> > > End While
> > > -----------------
> > > "For index Next reversal"
> > > Dim idx As Integer
> > > For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
> > > If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
> > > Me.Panel1.Controls.RemoveAt(idx)
> > > End If
> > > Next
> > > I hope this contribute something
> > > Cor
> > >
> > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Nak
Guest
 
Posts: n/a
#7: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Cor,

http://members.lycos.co.uk/nickpatemanpwp/mynews.htm

I uploaded a quick test of all 3 methods onto my web site, read the top item
on my news page for the download link. It's a tiny file and the tests just
go to show that there is practically nothing in it what so ever.

The test works by adding a user defined number of controls to a panel
(currently @ 10,000), these controls are randomly chosen to be either a
button or a label. The 3 routines then test removing only the label
controls and give a result in (ms), on my computer the results were,

While method = 9937ms
For method (reverese removal) = 9984
For method (my crappy forward removal method) = 9781

Nothing in it what so ever, so it's just a matter of personal preference and
ease of typing isn't it?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Cor
Guest
 
Posts: n/a
#8: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Nick,
Thanks,
As I promished I give no comments now except.
I measured while 15.453, for, 15.390, cr 15.281
But those slight differences say nothing because it is not a total clean
Computer (there are interupts).
Cor



Nak
Guest
 
Posts: n/a
#9: Nov 20 '05

re: Serious discussion about removing dynamically controls


> As I promished I give no comments now except.[color=blue]
> I measured while 15.453, for, 15.390, cr 15.281
> But those slight differences say nothing because it is not a total clean
> Computer (there are interupts).
> Cor[/color]

Hi Cor,

Agreed, the test isn't "clean" as such, but is a test ever clean on a
system with Windows running? It just goes to show how little is in it,
other than programming preference :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


One Handed Man
Guest
 
Posts: n/a
#10: Nov 20 '05

re: Serious discussion about removing dynamically controls


What the *&^% is this all about, a few milliseconds.


I agree with Nak, its down to personal preference

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"Nak" <a@a.com> wrote in message
news:OPpXzs5cDHA.2932@tk2msftngp13.phx.gbl...[color=blue][color=green]
> > As I promished I give no comments now except.
> > I measured while 15.453, for, 15.390, cr 15.281
> > But those slight differences say nothing because it is not a total clean
> > Computer (there are interupts).
> > Cor[/color]
>
> Hi Cor,
>
> Agreed, the test isn't "clean" as such, but is a test ever clean on a
> system with Windows running? It just goes to show how little is in it,
> other than programming preference :-)
>
> Nick.
>
> --
>[/color]
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\[color=blue]
> "No matter. Whatever the outcome, you are changed."
>
> Fergus - September 5th 2003
>[/color]
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\[color=blue]
>
>[/color]


Fergus Cooney
Guest
 
Posts: n/a
#11: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Stephanie,

Unfortunately, for me with v2002,
For I As Integer = ...
gives a syntax error. Glad it's been added to v2003.


I agree that:

For idx as Integer = Me.Panel1.Controls.Count - 1 To 0 Step -1
If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
Me.Panel1.Controls.RemoveAt(idx)
Next

is shorter, but to me it <looks> more complicated than with the If spread
out to three lines.

Regards,
Fergus


Fergus Cooney
Guest
 
Posts: n/a
#12: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Cor,

I prefer the For loop because it is simpler and shorter on the page.

Simpler for someone trying to understand it:

Correctness
With the For loop you need to ensure that it does
the correct thing in the If.

With the While you have to ensure that it does the
correct thing on both branches of the If.

Progression
The For loop <always>
decrements which makes it straghtforward.

You have to realise that it doesn't always increment,
and be happy that that makes sense.

Imagery
The imagery with the For loop is of going backwards
down a list saying either "You're ok" or "You - out" and
the line shuffling down to close the gap.

The imagery with the While is of going intermittently
forwards up a list saying either "You - stay" and moving
past, or "You - out. Next!" and the line shuffling up to
meet you.

As with the performance issue, the difference is marginal. :-)

For me the overriding consideration is that it takes fewer lines.Lines on the screen, to me, is one hell of a valuable
commodity.

Regards,
Fergus


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#13: Nov 20 '05

re: Serious discussion about removing dynamically controls


"Charles Law" <blah@thingummy.com> schrieb:[color=blue]
> ACK (that's me pretending to be Herfried ... I wish)
>
> The only thing I would probably change is
>
> Do While ... Loop
>
> instead of what is essentially a While ... Wend loop.[/color]

A 'While...End While' loop.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Charles Law
Guest
 
Posts: n/a
#14: Nov 20 '05

re: Serious discussion about removing dynamically controls


I didn't mistype it, but hasn't Wend only just been finally banished from
the language? Or did I just dream it!

Charles
[How do I do raised eyebrows, quizzical look? ):-[] maybe? If I have just
indicated something rude or offensive with my attempt, please ignore]


"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> wrote in message
news:OGAOO08cDHA.1828@TK2MSFTNGP10.phx.gbl...[color=blue]
> "Charles Law" <blah@thingummy.com> schrieb:[color=green]
> > ACK (that's me pretending to be Herfried ... I wish)
> >
> > The only thing I would probably change is
> >
> > Do While ... Loop
> >
> > instead of what is essentially a While ... Wend loop.[/color]
>
> A 'While...End While' loop.
>
> ;-)
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>[/color]


Cor
Guest
 
Posts: n/a
#15: Nov 20 '05

re: Serious discussion about removing dynamically controls


Herfried,
I asume this is not your contribution after all you did write last night.
I expect that Tom, Jeremy and Jay B do that for us when it is for us night
(Or is Tom too Europe?).
I think, this is more important than 6 man(3 MVP) who give answers how to
add a preceding zero to a string.
(Sorry but I had to laugh when I saw that)

After doing this the people active in this newsgroup can give an uniform
answer and we have again less so long useless threads anymore.

The only one who I can imaging who gives not comments is Armin, his idea it
obvious.
I and I think others too are curious to the ideas of you and the other
MVP's.

Cor


Cor
Guest
 
Posts: n/a
#16: Nov 20 '05

re: Serious discussion about removing dynamically controls


Charles,
I thought that too, but because of the discussion last night I did not want
to contribute that, lets do if the
while end loop is the same as the do while loop.
OK?
Cor


Cor
Guest
 
Posts: n/a
#17: Nov 20 '05

re: Serious discussion about removing dynamically controls


Charles
The reversal is the for index and not the Do While
I do not understand you.
when you say[color=blue]
> ACK (that's me pretending to be Herfried ... I wish)
>
> The only thing I would probably change is
>
> Do While ... Loop
>
> instead of what is essentially a While ... Wend loop.
>
> Charles
>[/color]


Cor
Guest
 
Posts: n/a
#18: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Nick
The test is very good to make the discussion beter I think Nick

I try to give no comments, makes evaluating much easier.

I keep doing it on my own way and you too.
But it is good for thinking it over.
Cor


Stephany Young
Guest
 
Posts: n/a
#19: Nov 20 '05

re: Serious discussion about removing dynamically controls


I think you'll find he was referring to the first example.

"Cor" <non@non.com> wrote in message
news:3f58d170$0$29436$48b97d01@reader20.wxs.nl...[color=blue]
> Charles
> The reversal is the for index and not the Do While
> I do not understand you.
> when you say[color=green]
> > ACK (that's me pretending to be Herfried ... I wish)
> >
> > The only thing I would probably change is
> >
> > Do While ... Loop
> >
> > instead of what is essentially a While ... Wend loop.
> >
> > Charles
> >[/color]
>
>[/color]


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#20: Nov 20 '05

re: Serious discussion about removing dynamically controls


"Cor" <non@non.com> schrieb:[color=blue]
> I asume this is not your contribution after all you did
> write last night.[/color]

???
[color=blue]
> I expect that Tom, Jeremy and Jay B do that for us when
> it is for us night (Or is Tom too Europe?).[/color]

What? I do not really understand what you mean.
[color=blue]
> I think, this is more important than 6 man(3 MVP) who give
> answers how to add a preceding zero to a string.
> (Sorry but I had to laugh when I saw that)[/color]

I had to laugh too.
[color=blue]
> After doing this the people active in this newsgroup can
> give an uniform answer and we have again less so long
> useless threads anymore.[/color]

I don't understand what you mean.
[color=blue]
> The only one who I can imaging who gives not comments
> is Armin, his idea it obvious.
> I and I think others too are curious to the ideas of you and
> the other MVP's.[/color]

???

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#21: Nov 20 '05

re: Serious discussion about removing dynamically controls


"Charles Law" <blah@thingummy.com> schrieb:[color=blue]
> I didn't mistype it, but hasn't Wend only just been finally
> banished from the language? Or did I just dream it![/color]

'Wend' doesn't exist any more.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#22: Nov 20 '05

re: Serious discussion about removing dynamically controls


"Cor" <non@non.com> schrieb:[color=blue]
> I thought that too, but because of the discussion last night I did
> not want to contribute that, lets do if the while end loop is
> the same as the do while loop.[/color]

???

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet



Jay B. Harlow [MVP - Outlook]
Guest
 
Posts: n/a
#23: Nov 20 '05

re: Serious discussion about removing dynamically controls


Cor,[color=blue]
> I expect that Tom, Jeremy and Jay B do that for us when it is for us night[/color]
Huh? someone talking about me??
[color=blue]
> After doing this the people active in this newsgroup can give an uniform
> answer and ...[/color]
My concern is there is no 'uniform' answer! As there are multiple ways of
doing the same thing, equally correct. If only one of us, gives a single
'uniform' answer, then we did not give all the options. Depending on the
situation, one of the other options may be the better solution.
[color=blue]
> ... we have again less so long useless threads anymore.[/color]
I try to avoid 'long useless threads'. If I feel I am communicating (two
way) an idea with someone & that idea may be beneficial for others I will
continue the thread (Richard & user controls come to mind). However if it
starts appearing that one of us is not getting what the other is saying, I
will 'drop the issue'. Or the discussion is largely "Oh Yea! mines bigger"
[color=blue]
> I think, this is more important than 6 man(3 MVP) who give answers how to
> add a preceding zero to a string.[/color]
However they where 6 distinct equally correct answers! :-)

Even if we all gave the same 6 answers, as Herfried has stated before, its a
matter of timing. I don't know if the other 5 are currently on, answering a
question, they one of them is happening to hit send at the same micron that
I am. Its impractically for us to communicate with each other that one of us
has it, there are just too many questions. Most of the MVPs I know have full
time jobs, in addition to answering questions. Plus they author books.

Just a thought
Jay

"Cor" <non@non.com> wrote in message
news:3f58c7b1$0$29430$48b97d01@reader20.wxs.nl...[color=blue]
> Herfried,
> I asume this is not your contribution after all you did write last night.
> I expect that Tom, Jeremy and Jay B do that for us when it is for us night
> (Or is Tom too Europe?).
> I think, this is more important than 6 man(3 MVP) who give answers how to
> add a preceding zero to a string.
> (Sorry but I had to laugh when I saw that)
>
> After doing this the people active in this newsgroup can give an uniform
> answer and we have again less so long useless threads anymore.
>
> The only one who I can imaging who gives not comments is Armin, his idea[/color]
it[color=blue]
> obvious.
> I and I think others too are curious to the ideas of you and the other
> MVP's.
>
> Cor
>
>[/color]


Cor
Guest
 
Posts: n/a
#24: Nov 20 '05

re: Serious discussion about removing dynamically controls


Jay,
That is an answer,
This is not a matter of what is good or bad, no meaning about it, is too a
meaning.
But I think that it is not good for a newsgroup when there are messages who
says: "I think that is basicly not good".
And I have seen a lot about this subject.
Tell why or don't write those messages.
It is the same as when I say I don't like beans.

Because you are an important contributer to this group, and did give your
idea's in a discussion I mean a week ago, I thought it was good if you did
contribute to this discussion too.
Nick did some work to make a test, I thought because some people say we must
measure that.

But if you have no meaning.
That is a meaning too.

Cor.


Cor
Guest
 
Posts: n/a
#25: Nov 20 '05

re: Serious discussion about removing dynamically controls


Herfried,
Just an opinion.
If you want to know my opinion that is the same as mid, instr, substring,
indexoff + & (not for uper an lowercase and ==) etc.
But if you can tell why you find one methodiek better than the other, that
would be too a contribution.
And if you want to illustrate that with a hyperlink too no problem.
But I have seen yesterday many ACK in your post when this was the subject.
And that has nothing personal for me.
This subject or the late night ACK's changes nothing in my thinking about
you.
And if you don't want to do that, too no problem, but write that, I do want
to try to make a evaluation on about sunday.
Cor


Charles Law
Guest
 
Posts: n/a
#26: Nov 20 '05

re: Serious discussion about removing dynamically controls


With you all the way Cor.

Charles


"Cor" <non@non.com> wrote in message
news:3f58cc89$0$29430$48b97d01@reader20.wxs.nl...[color=blue]
> Charles,
> I thought that too, but because of the discussion last night I did not[/color]
want[color=blue]
> to contribute that, lets do if the
> while end loop is the same as the do while loop.
> OK?
> Cor
>
>[/color]


Charles Law
Guest
 
Posts: n/a
#27: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Cor

It's just that I often see Herfried say "ACK" when he agrees with something.
The guy's obviously got a brain the size of a planet, so I can only aspire
to the breadth of his knowledge. Even if I did know all the stuff he knows,
I could never recall it all so quickly, and post links to relevant info all
the time.

Charles


"Cor" <non@non.com> wrote in message
news:3f58d170$0$29436$48b97d01@reader20.wxs.nl...[color=blue]
> Charles
> The reversal is the for index and not the Do While
> I do not understand you.
> when you say[color=green]
> > ACK (that's me pretending to be Herfried ... I wish)
> >
> > The only thing I would probably change is
> >
> > Do While ... Loop
> >
> > instead of what is essentially a While ... Wend loop.
> >
> > Charles
> >[/color]
>
>[/color]


Charles Law
Guest
 
Posts: n/a
#28: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Herfried

I don't think we are in disagreement. It's just my way of writing I think.

Charles


"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> wrote in message
news:%23$s79B%23cDHA.2640@TK2MSFTNGP09.phx.gbl...[color=blue]
> "Charles Law" <blah@thingummy.com> schrieb:[color=green]
> > I didn't mistype it, but hasn't Wend only just been finally
> > banished from the language? Or did I just dream it![/color]
>
> 'Wend' doesn't exist any more.
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>[/color]


Cor
Guest
 
Posts: n/a
#29: Nov 20 '05

re: Serious discussion about removing dynamically controls


He is young, when I was that age I could that too in a way, now I have to
say, for me it is the same as you Charles.
:-)


Fergus Cooney
Guest
 
Posts: n/a
#30: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Cor, Charles,

It also helps to have an installed copy of the Herfried Handy Hypertext Help system - 10 gigabytes of links searchable via a
Brain-to-PC interface (USB 2, I believe). :-)

Regards,
Fergus


José Manuel Agüero
Guest
 
Posts: n/a
#31: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello, group:

I think you are building a planet from a grain of sand.
I'd prefer to give my contribution code working and tested, but I can't wait until tomorrow to write it on the computer in wich I have .NET installed. I hope you understand my intention and forgive the errors:

sub DeleteTextBoxes()
dim ctllist as Collection
dim ctl as control

for each ctl in me.controls
if typeof(ctl) is textbox then
ctllist.add ctl
end if
next

for each ctl in ctllist
me.controls.remove(ctl)
'Other cleaning stuff...
next

ctllist.clear 'Deletes the last reference to textboxes (unnecesary because ctllist stops existing when the sub ends).
end sub

I hope this works (and you like it)

Regards.


"Cor" <non@non.com> escribió en el mensaje news:3f58434d$0$15318$48b97d01@reader20.wxs.nl...
| Hi,
| I start a new thread about a discussion from yesterday (or for some of us
| this morning). It was a not so nice discussion about dynamically removing
| controls from a panel or what ever.
| It started by an example from me, that was far from complete and with typing
| errors, but basically it had the meaning to show that removing controls
| reversible was the nicest method.
|
| This was a lets say conclusion (but what is that in a newsgroup) in a
| discussion some weeks ago in this newsgroup. The method was contributed by
| Armin. I found it brilliant and since that time I call this the method
| Armin.
|
| Jack did totally disagree with this method and did after a while contribute
| some code.
|
| Therefore I send both code's to this newsgroup in this new thread. I think
| it is good to talk professionally about it. So it is not the code Cor, Nick,
| Armin or Jack. Just the method "reverse For next loop", against the "While
| end while loop" for removing controls dynamically.
|
| I don't want to start with my + of - points about the methods, maybe I will
| give that, but I hope that it will come automatically in this newsgroup
|
| The code that Jack has given some contribution for me, because I did not
| know "removeAT" exist. But I always do the things that I do plus in the same
| way minus. So I doubt if I will use it, but for the example I did use
| "removeAT" (I think it is nicer). Please don't start a discussion about
| that. The question is the "While end while" against reversal "For next".
|
| "While end While"
| Dim idx As Integer
| idx = 0
| While idx < Me.Panel1.Controls.Count ' while in bounds
| If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
| Me.Panel1.Controls.RemoveAt(idx)
| Else
| idx = idx + 1 ' otherwise advance to next control
| End If
| End While
| -----------------
| "For index Next reversal"
| Dim idx As Integer
| For idx = Me.Panel1.Controls.Count - 1 To 0 Step -1
| If TypeOf Me.Panel1.Controls.Item(idx) Is Label Then
| Me.Panel1.Controls.RemoveAt(idx)
| End If
| Next
| I hope this contribute something
| Cor
|
|
|
|
Fergus Cooney
Guest
 
Posts: n/a
#32: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Jose,

But it's a hell of a great planet!!

I've seen your method before. It is very unambiguous and there are no worries about whether you are tripping over your own tail.
First you collect. Then you remove. Simple.

But, as I mentioned in my post above, screen space is very important, so, for me, it is too long.

However, welcome to the debate. :-)

Regards,
Fergus


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#33: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Cor" <non@non.com> schrieb:[color=blue]
> He is young, when I was that age I could that too in a way, now I have to
> say, for me it is the same as you Charles.[/color]

;-)

When you were young, there was probably no .NET framework available.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#34: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Fergus Cooney" <filter-1@tesco.net> schrieb:[color=blue]
> But it's a hell of a great planet!!
>
> I've seen your method before. It is very unambiguous and there
> are no worries about whether you are tripping over your own tail.
> First you collect. Then you remove. Simple.
>
> But, as I mentioned in my post above, screen space is very important,
> so, for me, it is too long.[/color]

Encapsulate it...

;-)))

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#35: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Charles Law" <blah@thingummy.com> schrieb:[color=blue]
> I don't think we are in disagreement. It's just my way of writing I think.[/color]

That's what I think too.

:-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Cor
Guest
 
Posts: n/a
#36: Nov 20 '05

re: Serious discussion about removing dynamically controls


Haha. I have a sent folder with 20,000 postings I wrote in the past. A
lot[color=blue]
> of questions can be answered by querying this folder. And: I use Google
> Groups Search and the MSDN documentation. For some unknown reason, most
> people do not have a look at the docs before asking a question.
>[/color]
I was thinking about that Yesterday when I did read the message from
Charles,
I had always said, in this bussiness it't not important to know, just to
know where it is written.
And then I thought how would that be with Herfried, but you did send the
answer.

I did make that folder too last week.
A lot of Herfried, Jay B and now Fergus is in it.
The last one was a letter M.
The other things I can remember.
:-)
Cor


Cor
Guest
 
Posts: n/a
#37: Nov 20 '05

re: Serious discussion about removing dynamically controls


Herfried,
That is an answer,
:-)
Cor


Nak
Guest
 
Posts: n/a
#38: Nov 20 '05

re: Serious discussion about removing dynamically controls


> When you were young, there was probably no .NET framework available.

Were there computers then? I thought people used the abacus? ;-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Cor
Guest
 
Posts: n/a
#39: Nov 20 '05

re: Serious discussion about removing dynamically controls


That was not yet invented only fingers and tones


Nak
Guest
 
Posts: n/a
#40: Nov 20 '05

re: Serious discussion about removing dynamically controls


> That was not yet invented only fingers and tones

LOL, like "Ug!" ? ;-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Fergus Cooney
Guest
 
Posts: n/a
#41: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Cor,

|| The last one was a letter M.

Lol.

Regards,
Fergus


Fergus Cooney
Guest
 
Posts: n/a
#42: Nov 20 '05

re: Serious discussion about removing dynamically controls


ROFL


José Manuel Agüero
Guest
 
Posts: n/a
#43: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello:

Really I haven't read a book about programming since I started programming the PC (it was a manual for VB3). I have only read the help provided by Microsoft with posterior releases of VB.

So I'm quite lost (apart from my bad English) when you say things in this context like "screen space is very important" and "Encapsulate it" :'-(

Well, you're really building a great planet of knowledge in this newsgroup and I will take as much advantage of it as I can :-)

Regards.

P.S. Is there any native English-speaking people here? I'm Spanish and I know many of you are not English... ;-)

Regards again.


"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> escribió en el mensaje news:eScGOxDdDHA.2176@TK2MSFTNGP09.phx.gbl...
| Hello,
|
| "Fergus Cooney" <filter-1@tesco.net> schrieb:
| > But it's a hell of a great planet!!
| >
| > I've seen your method before. It is very unambiguous and there
| > are no worries about whether you are tripping over your own tail.
| > First you collect. Then you remove. Simple.
| >
| > But, as I mentioned in my post above, screen space is very important,
| > so, for me, it is too long.
|
| Encapsulate it...
|
| ;-)))
|
| --
| Herfried K. Wagner
| MVP · VB Classic, VB.NET
| http://www.mvps.org/dotnet
|
|
Fergus Cooney
Guest
 
Posts: n/a
#44: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi Jose,

I'm a Londoner. You'll get correct English from me and also slang. Naa wot ar mean, like?*

|| "screen space is very important"

By this I mean that I like my code to be as compact as possible so that I can see as much as possible on the screen. That's one
of the reasons that I like C# compared to VB.NET.

C#
public int Foo { get { return m_Foo; } set { m_Foo = (value <= 0) ? 1 : value; }}

vs
Public Property Foo As Integer
Get
Return m_Foo
End Get
Set
m_Foo = IIf (Value <= 0, 1, Value)
End Set
End Property

One line versus 8!!

|| "Encapsulate it"

Herfried is saying. Don't worry about the length - write it as a routine in a a module, eg ControlsLib.RemoveControls
(Collection, Type), and call it. That'll bring it down to a single line it the calling code. And there'll be another useful utility
in the Controls library.

Regards,
Fergus
*
"Naa wot ar mean, like?"
Similar: Get me drift?
Meaning: Does this make sense?
Literally, formally - Do you understand what I mean?

:-)


José Manuel Agüero
Guest
 
Posts: n/a
#45: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hi, Fergus:

Thanks for the explanation.

:-)

Regards


"Fergus Cooney" <filter-1@tesco.net> escribió en el mensaje news:%23unZKAMdDHA.2816@TK2MSFTNGP09.phx.gbl...
| Hi Jose,
|
| I'm a Londoner. You'll get correct English from me and also slang. Naa wot ar mean, like?*
|
| || "screen space is very important"
|
| By this I mean that I like my code to be as compact as possible so that I can see as much as possible on the screen. That's one
| of the reasons that I like C# compared to VB.NET.
|
| C#
| public int Foo { get { return m_Foo; } set { m_Foo = (value <= 0) ? 1 : value; }}
|
| vs
| Public Property Foo As Integer
| Get
| Return m_Foo
| End Get
| Set
| m_Foo = IIf (Value <= 0, 1, Value)
| End Set
| End Property
|
| One line versus 8!!
|
| || "Encapsulate it"
|
| Herfried is saying. Don't worry about the length - write it as a routine in a a module, eg ControlsLib.RemoveControls
| (Collection, Type), and call it. That'll bring it down to a single line it the calling code. And there'll be another useful utility
| in the Controls library.
|
| Regards,
| Fergus
| *
| "Naa wot ar mean, like?"
| Similar: Get me drift?
| Meaning: Does this make sense?
| Literally, formally - Do you understand what I mean?
|
| :-)
|
|
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#46: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Cor" <non@non.com> schrieb:[color=blue][color=green]
> > Haha. I have a sent folder with 20,000 postings I wrote
> > in the past. A lot of questions can be answered by querying
> > this folder. And: I use Google Groups Search and the MSDN
> > documentation. For some unknown reason, most
> > people do not have a look at the docs before asking a question.[/color]
>
> I was thinking about that Yesterday when I did read the message from
> Charles, I had always said, in this bussiness it't not important to
> know, just to know where it is written.[/color]

I fully agree.
[color=blue]
> And then I thought how would that be with Herfried, but you did send the
> answer.
>
> I did make that folder too last week.
> A lot of Herfried, Jay B and now Fergus is in it.
> The last one was a letter M.
> The other things I can remember.[/color]

Notice that you can query "all" messages of this ng by using Google Groups
Search.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#47: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Cor" <non@non.com> schrieb:[color=blue]
> That is an answer,
> :-)[/color]

Now I am back, but there are hundreds of unanswered messages waiting for
me...

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#48: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"Nak" <a@a.com> schrieb:[color=blue][color=green]
> > When you were young, there was probably no .NET
> > framework available.[/color]
>
> Were there computers then? I thought people used the
> abacus? ;-)[/color]

No, but Commodore or Amiga knowledge doesn't help answering questions in
this ng.

;-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#49: Nov 20 '05

re: Serious discussion about removing dynamically controls


Hello,

"José Manuel Agüero" <jmaguero@vodafone.es> schrieb:[color=blue]
>So I'm quite lost (apart from my bad English)[/color]

Huh. My English is very bad...
[color=blue]
> when you say things in this context like "screen space is very
> important" and "Encapsulate it" :'-([/color]

I wanted to tell you that you write a little procedure that "encapsulates"
the routine and makes it reusable. You don't need to worry about the
implementation every time you use the procedure.
[color=blue]
> P.S. Is there any native English-speaking people here? I'm Spanish
> and I know many of you are not English... ;-)[/color]

I live in Austria.

:-)

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


José Manuel Agüero
Guest
 
Posts: n/a
#50: Nov 20 '05

re: Serious discussion about removing dynamically controls


;-)


"Herfried K. Wagner [MVP]" <hirf.nosp@m.activevb.de> escribió en el mensaje news:ef7AFiNdDHA.2804@TK2MSFTNGP11.phx.gbl...
|
| I live in Austria.
|
| :-)
|
| --
| Herfried K. Wagner
| MVP · VB Classic, VB.NET
| http://www.mvps.org/dotnet

Closed Thread