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

Home Posts Topics Members FAQ

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

Wierd For...Each behavior

Tom
This is very strange: I have a Windows Form with a Panel on it. In that
panel I dynamically (at run time) create some labels, as so:

for i=1 to x
dim ctlNew as New Label()
with ctlNew
.Name="Whatever" & trim(cstr(i))
.Text=.Name
.Visible=True
... etc etc etc ...
end with
MyPanel.Controls.Add(ctlNew)

This shows up fine when the form is displayed. However, I also have a reset
button on the form, which goes thru and destroys the labels, as such:

dim ctl as Control
for each ctl in MyPanel.Controls
if typeof ctl is Label then
ctl.text=""
ctl.visible=False
ctl.Dispose()
end if
next

OK, here is the WIERD thing: The For...Each loop only seems to pick up the
EVEN or ODD numbered controls! It skips some of the controls (i.e. the odd
ones).... if I rerun the loop about three times, one right after the other,
it will finally pick up all the controls and get rid of them.

I -think- the code is correct - I even added a ctl=Nothing before and/or
after the ctl.Dispose(), but it didn't help. The For...Each loop just seems
the skip some of the label controls during its run. I am baffled ... even
though it is probably something dumb that I am doing.

Anyone got any ideas on this?

Tom

Nov 20 '05 #1
112 3904
Cor
Tom,
dim ctl as Control
for each ctl in MyPanel.Controls
if typeof ctl is Label then
ctl.text=""
ctl.visible=False
ctl.Dispose()
end if
next

I think that the collections in the for each loop is changed in the the for
each loop
I think that nicer is
For i = Me.Controls.Count To 0 Step -1
Dim ctl As Control
it typeof ctl is Label then
Me.Controls.Remove(ctl)
Next
I hope this helps
Cor
Nov 20 '05 #2
Why don't you just set the labels to nothing? Dispose is called by the GC.
All you really have to do it kill your reference to the object. Let the GC
take care of the rest.
"Tom" <To*@nospam.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
This is very strange: I have a Windows Form with a Panel on it. In that
panel I dynamically (at run time) create some labels, as so:

for i=1 to x
dim ctlNew as New Label()
with ctlNew
.Name="Whatever" & trim(cstr(i))
.Text=.Name
.Visible=True
... etc etc etc ...
end with
MyPanel.Controls.Add(ctlNew)

This shows up fine when the form is displayed. However, I also have a reset button on the form, which goes thru and destroys the labels, as such:

dim ctl as Control
for each ctl in MyPanel.Controls
if typeof ctl is Label then
ctl.text=""
ctl.visible=False
ctl.Dispose()
end if
next

OK, here is the WIERD thing: The For...Each loop only seems to pick up the
EVEN or ODD numbered controls! It skips some of the controls (i.e. the odd
ones).... if I rerun the loop about three times, one right after the other, it will finally pick up all the controls and get rid of them.

I -think- the code is correct - I even added a ctl=Nothing before and/or
after the ctl.Dispose(), but it didn't help. The For...Each loop just seems the skip some of the label controls during its run. I am baffled ... even
though it is probably something dumb that I am doing.

Anyone got any ideas on this?

Tom

Nov 20 '05 #3
Isn't Controls.Count a one-based index? I think it should be:

For i = Me.Controls.Count -1 To 0 Step -1
....
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader21.wxs.nl...
Tom,
dim ctl as Control
for each ctl in MyPanel.Controls
if typeof ctl is Label then
ctl.text=""
ctl.visible=False
ctl.Dispose()
end if
next I think that the collections in the for each loop is changed in the the

for each loop
I think that nicer is
For i = Me.Controls.Count To 0 Step -1
Dim ctl As Control
it typeof ctl is Label then
Me.Controls.Remove(ctl)
Next
I hope this helps
Cor

Nov 20 '05 #4
Tom
Yea, stupid me, I just figured this out when everyone replied. Sheesh, I
should have seen that. Anyway, I'll go in reverse and remove the items that
way. Thanks.

Tom

"Nak" <a@a.com> wrote in message
news:um**************@tk2msftngp13.phx.gbl...
OK, here is the WIERD thing: The For...Each loop only seems to pick up the EVEN or ODD numbered controls! It skips some of the controls (i.e. the odd ones).... if I rerun the loop about three times, one right after the other,
it will finally pick up all the controls and get rid of them.


I have "an" idea, maybe it's because you are removing a control from the
collection in the loop, for example if you used a For loop and removed
controls without taking away 1 from the final index you would over run and
skip controls in a similar way. Maybe try using an integer controlled for
loop and every time you remove a control take away 1 from the counter and

1 from the final index. I've attached an example, excuse the type checking
code, I know it's bad, also I have added a button to simulate the problem
you are getting at current.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Nov 20 '05 #5

"Cor" <no*@non.com> wrote in message
news:3f***********************@reader21.wxs.nl...
Tom,
dim ctl as Control
for each ctl in MyPanel.Controls
if typeof ctl is Label then
ctl.text=""
ctl.visible=False
ctl.Dispose()
end if
next I think that the collections in the for each loop is changed in the the

for each loop
I think that nicer is
For i = Me.Controls.Count To 0 Step -1
Dim ctl As Control
it typeof ctl is Label then
Me.Controls.Remove(ctl)
Next
I hope this helps
Cor


It doesn't help when you post bad code that doesn't work, despite your good
intentions.

You also might want to learn when to use While or Do loops instead of
misusing a For loop.
Nov 20 '05 #6
Cor
Robert
You are right, just forgot to type.
Thanks for your attention.
Cor
Nov 20 '05 #7

"Scott Meddows" <sc******************@tsged.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why don't you just set the labels to nothing? Dispose is called by the GC. All you really have to do it kill your reference to the object. Let the GC take care of the rest.


Because that won't work for controls. Controls are referenced by their
container, so it doesn't matter whether you set all code references to
nothing: the container will still hold a reference until you remove the
control or the container itself.
Nov 20 '05 #8
Cor
Jack.
Yes I mistyped the -1 but that can every programmer with a little expirience
see.
Robert was so kind to tell that.

But show that you can do it better, send a good working code in this
situation with the do while loop.
Cor
Nov 20 '05 #9
Then you'd have to loop through a loop and do the
container.controls.remove(YourForEachLoopControl) ?

"Jack Spry" <js***@nospammers.com> wrote in message
news:OG**************@TK2MSFTNGP12.phx.gbl...

"Scott Meddows" <sc******************@tsged.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why don't you just set the labels to nothing? Dispose is called by the

GC.
All you really have to do it kill your reference to the object. Let the

GC
take care of the rest.


Because that won't work for controls. Controls are referenced by their
container, so it doesn't matter whether you set all code references to
nothing: the container will still hold a reference until you remove the
control or the container itself.

Nov 20 '05 #10

"Cor" <no*@non.com> wrote in message
news:3f**********************@reader21.wxs.nl...
Jack.
Yes I mistyped the -1 but that can every programmer with a little expirience see.
Robert was so kind to tell that.

Apparently, you fail to see why your code won't work. Here's a hint: the
if statement always evalutes to false.
But show that you can do it better, send a good working code in this
situation with the do while loop.


Maybe you should post code that works before you command others to do so,
padawan.
Nov 20 '05 #11
"Jack Spry" <js***@nospammers.com> schrieb:
You also might want to learn when to use While or
Do loops instead of misusing a For loop.


If you have a working solution, feel free to post it. Do not shout at other
people there if you do not contribute to the ng.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #12
Cor
Hi,
The example code was full of typing errors, it was ment as an example.
But because there are maybe real beginners looking to it, who can not
evaluate that, under the typed example from what I think that will work on a
form.
For i = Me.Controls.Count To 0 Step -1
Dim ctl As Control
it typeof ctl is Label then
Me.Controls.Remove(ctl)

There is not even an if in this example but an it..
\\\\\\
Dim i As Integer
For i = Me.Controls.Count - 1 To 0 Step -1 'As something with what I
always must think to Armin
Dim ctrl As Control = Me.Controls.Item(i)
If TypeOf ctrl Is Label Then
Me.Controls.Remove(ctrl)
End If
Next
/////
Cor
Nov 20 '05 #13
Cor
Hi Jack Padawan,
There is no If in it, that is also a typing error, but don't give critique
Come with that nice example with a "do while loop".
We are waiting
Cor
Nov 20 '05 #14

"Scott Meddows" <sc******************@tsged.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Then you'd have to loop through a loop and do the
container.controls.remove(YourForEachLoopControl) ?


Yes, you need to remove the controls from the container, as well as any
event handlers that were attached, if necessary. There are several ways to
do that, depending on the circumstances. Since removing controls
dynamically changes the container, it would be best not to use a looping
structure such as ForEach to iterate over the contents, since this is
pulling the rug out from under yourself.
Nov 20 '05 #15
Cor
Come with your Example, but we will see, tomorrow there is nothing and the
day after tomorrow again
Nov 20 '05 #16
Hi Jack,

Shame you're having a bad week. Still, you're always welcome to come here
and inappropriately vent your spleen. We like to be helpful. If we can't do
that then we're happy to be punchbags for people with a bit a of anger and
frustration.

Hope this helps.

NOT

Fergus
Nov 20 '05 #17
Nak
> Yea, stupid me, I just figured this out when everyone replied. Sheesh, I
should have seen that. Anyway, I'll go in reverse and remove the items that way. Thanks.


Hi,

Yeah, that would make sence :-) Never mind.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #18
Still here Jack ?

|| Yes, you need to remove ..... blah, blah, .....
|| ..... best not to use a looping structure .....
|| since this is pulling the rug out from under yourself.

And we've <yet> to see your code contribution. Don't just criticise and talk
about it. Post the code. It's no challenge for a man of your calibre is it?

Fergus
Nov 20 '05 #19
Nak
> Come with your Example, but we will see, tomorrow there is nothing and the
day after tomorrow again


Hi there,

Technically speaking what Jack says is correct. But that doesn't
account for the manner in which he is conducting himself at the moment.

Jack, please notice that this is a newsgroup for people wanting to learn
VB.NET as well as for people wanting to pool their knowledge of it. Fair
enough we all have a pop at each other now and then, but there is usually a
good reason for it, remember that when people post code it hasn't always
been tested, it's just been posted to show an example, this is called pseudo
code. So calm down a little please, you will only make yourself unpopular
here.

The problem is solved now anyway, so why the need to argue?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #20
Nak
> And we've <yet> to see your code contribution. Don't just criticise and
talk
about it. Post the code. It's no challenge for a man of your calibre is

it?

Hi Fergus,

LOL! My that's a mighty spoon of much spoon'ness that you have in your
very hands!

Smite him so!! ;-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #21

"Fergus Cooney" <fi******@tesco.net> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
Hi Jack,

Shame you're having a bad week. Still, you're always welcome to come here and inappropriately vent your spleen. We like to be helpful. If we can't do that then we're happy to be punchbags for people with a bit a of anger and
frustration.

Hope this helps.

NOT


My week is going quite nicely. Perhaps you fail to distinguish between
legitimate code criticism and flaming. I'm less inclined to post code when
someone _demands_ that I do so, particularly when they obviously haven't
even bothered to see if their own code compiles, or even works, before I
have the opportunity to volunteer my own suggestion. Only the people who
pay me get the right to dictate how and when I write code for them.

Nov 20 '05 #22
Cor
Nick,
Armin, Jay B and someone else where arguing about this subject a while ago
in this newsgroup.
(Armin not realy he was keeping his mouth, I think he knew that he was
right)
I did contribute not much, just evaluating and testing what Jay and the
otherone (It is a regular one but I forgot who it was) where saying.
At the end we could see, that the reverse indexed for loop that Armin had
supplied was the best.
In my mind I was started with do while, but when you evaluate and test that
will give unpredictable errors.
Therefore I gladly like to see a good working do while for deleting controls
with less code than Armins one.
The one that Armin had added was only
For i = 1 to col-1 step -1
But there was in my eyes an other error with the dispose, I did want to show
that too.
Therefore I added some lines, without testing it was the remove I did want
to show.
So I am waiting on the nice do while routine.
So technical it is not wrong and I think that was just to prickle me.
:-)
Cor

Nov 20 '05 #23
Nak
> someone _demands_ that I do so, particularly when they obviously haven't
even bothered to see if their own code compiles, or even works, before I


Hi Jack,

It's called "Psuedo code" okay?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #24

"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Hi Jack Padawan,
There is no If in it, that is also a typing error, but don't give critique
I am not attempting to point out any typographical errors (of which there
are many, but that's besides the point.)

You have declared a reference variable 'ctl' but have failed to assign it to
anything, and then you evaluate to see what type it contains - which will
always be Nothing.
Come with that nice example with a "do while loop".
We are waiting
Cor


Perhaps your time is best spent attempting to write code that works while
you're waiting for my solution. I was in the process of posting such code
myself, until I read your childish flurry of posts demanding that I do so.
Unlike yourself, I prefer to post code that works, and sometimes that takes
more than a few minutes to do. You have no right to demand anything from
me, particularly with the quality of the code you've posted to this point.
I fully expect that you'll continue to incessantly post your childish
demands for me to do so, however I'll go ahead and post it for the benefit
of the group, despite your taunts.

I'm also in the habit of actually testing any code that I post to be sure
that it works, which might be a foreign concept to you. However, I'm not
posting from my development system, so I was waiting to do so in a few
hours. Since nobody here is willing to cut me a f...in' break, I'll go
ahead and post without doing so, but only under duress. I fully expect that
you'll choose to jump on any error in my post, however trivial it may be,
instead of providing working code of your own making, but I guess that's
something I'll have to risk to keep you from posting several dozen messages
in the next hour or two.

Dim idx As Integer

idx = 0

While idx < MyPanel.Controls.Count ' while in bounds
if typeof MyPanel.Controls.Item(idx) is Label then
MyPanel.Controls.RemoveAt(idx)
else
idx = idx + 1 ' otherwise advance to next control
end if
End While

Nov 20 '05 #25
Nak
> It's called "Psuedo code" okay?

Spelling mistakes 'no all, "Pseudo" rather.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #26
Nak
Hi Cor,

You won't get any code out of Jack!, maybe allot of bullshit but not
code!

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #27

"Nak" <a@a.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
It's called "Psuedo code" okay?


Spelling mistakes 'no all, "Pseudo" rather.

Nick.

Pseudocode has nothing to do with bad VB.NET code that doesn't work. Now
that you've looked up the spelling, you might as well also look up the
meaning.
Nov 20 '05 #28

"Nak" <a@a.com> wrote in message
news:eQ**************@TK2MSFTNGP11.phx.gbl...
Hi Cor,

You won't get any code out of Jack!, maybe allot of bullshit but not
code!


So why don't you post your code?
Nov 20 '05 #29
Hi Jack,

|| My week is going quite nicely.

Like I care.

|| Perhaps you fail to distinguish between
|| legitimate code criticism and flaming.

I distinguish very subtle differences in tone. I detected in yours hints
of smirk and holier-than-thou. Legitimate code criticism is done with
sensitivity. Yours was not apparent.

|| I'm less inclined to post code when someone _demands_ that I do so

But you're quite happy to make demands on others.

|| particularly when they obviously haven't even
|| bothered to see if their own code compiles

As everyone has pointed out - this is a pseudo point.

|| Only the people who pay me get the right to dictate
|| how and when I write code for them.

I pity you. The people who pay me dictate <what> I write for them. They
pay me to know the how. And they trust me enough to give me great self
determination over the when.

Yours, with more than a hint of smirk and superiority, and self-righteous this
and that,
Fergus

ps. Thank you for the opportunity to vent my spleen, anger and frustration.
Nov 20 '05 #30
Cor
Mr. Padawan,
Maybe you cannot type that fast, but for you start to try that, take a look
at the answering post from Tom.
Cor
Nov 20 '05 #31

"Fergus Cooney" <fi******@tesco.net> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
Hi Jack,
ps. Thank you for the opportunity to vent my spleen, anger and frustration.


Yes, you would rather do that than post your own solution, hypocrite.
Nov 20 '05 #32

"Nak" <a@a.com> wrote in message
news:eQ**************@TK2MSFTNGP11.phx.gbl...
Hi Cor,

You won't get any code out of Jack!, maybe allot of bullshit but not
code!


I'm still waiting for your code.
Nov 20 '05 #33

"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Come with your Example, but we will see, tomorrow there is nothing and the
day after tomorrow again


Let's see who was the first one to post a _working_ example. Put up, or
shut up yourself. I know that you'd rather challenge me than write code
that works,so my code's posted. Where's yours? I'm still waiting. What's
the hold up on your end? Too busy posting flames to write code that works?
Nov 20 '05 #34
Nak
> I am not attempting to point out any typographical errors (of which there
are many, but that's besides the point.)
Nice contradiction Jack!
You have declared a reference variable 'ctl' but have failed to assign it to anything, and then you evaluate to see what type it contains - which will
always be Nothing.
That's because it was untested pseudo code, is that such a big deal? It
wasn't even your question in the first place so why are you getting so
emotional Jack?
Perhaps your time is best spent attempting to write code that works while
you're waiting for my solution. I was in the process of posting such code
myself, until I read your childish flurry of posts demanding that I do so.
Unlike yourself, I prefer to post code that works, and sometimes that takes more than a few minutes to do. You have no right to demand anything from
me, particularly with the quality of the code you've posted to this point.
I fully expect that you'll continue to incessantly post your childish
demands for me to do so, however I'll go ahead and post it for the benefit
of the group, despite your taunts.
You are totally right, no one has the right to demand anything from you, but
on the other hand they have every right to treat you like a c*nt if you act
like one! And don't worry, he won't be the only one to flame you in this
newsgroup, I should imagine plenty of other people would gladly oblige Jack!
I'm also in the habit of actually testing any code that I post to be sure
that it works, which might be a foreign concept to you. However, I'm not
posting from my development system, so I was waiting to do so in a few
hours. Since nobody here is willing to cut me a f...in' break, I'll go
ahead and post without doing so, but only under duress. I fully expect that you'll choose to jump on any error in my post, however trivial it may be,
instead of providing working code of your own making, but I guess that's
something I'll have to risk to keep you from posting several dozen messages in the next hour or two.
Development system huh? You're getting flash, so what are you using now
then? You're gaming system maybe, and you have been disturbed half way
through a game, that's why you're upset? Oh no wait, no one is willing to
cut you a "f...in' break", has that got anything to do with you being an
uptight self-righteous bastard that has obviously got out of bed on the
wrong side? I don't think that this has got anything to do with code
anymore? Do you Jack?

Maybe you might want to take a look at the amount of people that Cor
actually helps. I must admit that I have had arguments with Cor in the
past, but this was simply due to his misunderstanding of my posts. But this
on the other hand is simply down to you trying to flex some programming
muscle in the newsgroup, and just looking like a small girl in lilac who has
just dropped her dummy out of the pram. There is no law saying that you
cannot write pseudo code in a newsgroup, most people are smart enough to
work their way around it, and if not it gives them an incentive to. What
would you think is the best way to learn? like a parrot of with guidance,
what way Jack?

You also seem very defensive about writing any mistakes, I wonder why that
is, anything to do with you making a big mistake by starting all of this in
the first place? Are you all right Jack? Well are you Jack?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"Jack Spry" <js***@nospammers.com> wrote in message
news:O9**************@tk2msftngp13.phx.gbl...
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Hi Jack Padawan,
There is no If in it, that is also a typing error, but don't give
critique
Come with that nice example with a "do while loop".
We are waiting
Cor


Dim idx As Integer

idx = 0

While idx < MyPanel.Controls.Count ' while in bounds
if typeof MyPanel.Controls.Item(idx) is Label then
MyPanel.Controls.RemoveAt(idx)
else
idx = idx + 1 ' otherwise advance to next control
end if
End While

Nov 20 '05 #35
Nick's code was posted several hours ago!!
Nov 20 '05 #36
"Pseudo" - synonym of spurious, as in "Jack spouted spurious arguments".
Nov 20 '05 #37

"Cor" <no*@non.com> wrote in message
news:3f**********************@reader22.wxs.nl...
Mr. Padawan,
Maybe you cannot type that fast, but for you start to try that, take a look at the answering post from Tom.
Cor


If you spent more time reading than posting, you might actually learn
something.
Nov 20 '05 #38
Nak
> Pseudocode has nothing to do with bad VB.NET code that doesn't work. Now
that you've looked up the spelling, you might as well also look up the
meaning.


For who's benefit, yours? Everyone else here is smart enough to know what
it means, it's the outline of code, it doesn't have to function correctly
but simply give a logical outline that should provide the final solution.
Pseudo code can also have errors in it strangely enough, for example,

1. Flame Cor's code aggressively in newsgroup
2. While receiving flack from doing the above
2.1 Act like a complete tosser
2.2 Become very unpopular in the newsgroup
2.3 End While
3. Leave, with tail between legs.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #39
Nak
> Let's see who was the first one to post a _working_ example. Put up, or
shut up yourself. I know that you'd rather challenge me than write code
that works,so my code's posted. Where's yours? I'm still waiting. What's the hold up on your end? Too busy posting flames to write code that

works?
Bingo, it was myself JACK, in the form of a Zip file.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #40
Nak
> I'm still waiting for your code.

Try pulling your head out of your arse then Jack, I submitted code in the
form of a zip file. If you can't be bothered to read the other posts first
then is this really going to go anywhere? Happy Jack?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #41
Nak
> "Pseudo" - synonym of spurious, as in "Jack spouted spurious
arguments".

Couldn't be closer to the truth Fergus, apparently I haven't submitted any
code! Strange that, I could have sworn I wrote some an put it into a zip
file. It may not have been the best of code, but that's usually what
happens when you are eager to help someone out. Do you think Jack is
alright? I feel that he might have burst a blood vessel whilst inserting
his head up his arse.

Nick,

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #42

"Nak" <a@a.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl...
I am not attempting to point out any typographical errors (of which there are many, but that's besides the point.)
Nice contradiction Jack!
You have declared a reference variable 'ctl' but have failed to assign it to
anything, and then you evaluate to see what type it contains - which

will always be Nothing.


That's because it was untested pseudo code, is that such a big deal? It
wasn't even your question in the first place so why are you getting so
emotional Jack?


http://www.wikipedia.org/wiki/Pseudocode

Code that doesn't work isn't pseudocode. It's merely bad code. The whole
point of pseudocode is to focus on the meaning rather than the
implementation, not to explain away implementation code that doesn't work.

Here's some pseudocode:

For every Nak
drop dead

I wish there was a listing for Pseudoprogrammer, which up till now, is all
that you've shown yourself to be in this thread.

It seems pointless to discuss anything here with you. You're more
interested in flaming than code, pseudo or real.
Nov 20 '05 #43

"Nak" <a@a.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Pseudocode has nothing to do with bad VB.NET code that doesn't work. Now that you've looked up the spelling, you might as well also look up the
meaning.


For who's benefit, yours? Everyone else here is smart enough to know what
it means, it's the outline of code, it doesn't have to function correctly
but simply give a logical outline that should provide the final solution.
Pseudo code can also have errors in it strangely enough, for example,

1. Flame Cor's code aggressively in newsgroup
2. While receiving flack from doing the above
2.1 Act like a complete tosser
2.2 Become very unpopular in the newsgroup
2.3 End While
3. Leave, with tail between legs.


I'm still waiting for your code.
Nov 20 '05 #44
Nak
> It seems pointless to discuss anything here with you. You're more
interested in flaming than code, pseudo or real.


And you know the meaning of the word discuss do you Jack?

I think we may have just found the god of programmers,

All bow to Jack,
He is the ultimate coder,
The master blaster of basic,
The perfectionist of polymorphism,
The Jack of all,
and the master of none.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #45
Nak
> I'm still waiting for your code.

LOL! Your utter stupidity makes me crawl inside of my very skin, are you
feeling a tad on the sexually frustrated side? Again Jack, just for your
benefit, pull your head out of your arse and look, I submitted it in the
form of a zip, to which I received a warm reply, one of which you will
probably never receive with an attitude like that!

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #46

"Nak" <a@a.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Pseudo" - synonym of spurious, as in "Jack spouted spurious

arguments".

Couldn't be closer to the truth Fergus, apparently I haven't submitted any
code! Strange that, I could have sworn I wrote some an put it into a zip
file. It may not have been the best of code, but that's usually what
happens when you are eager to help someone out. Do you think Jack is
alright? I feel that he might have burst a blood vessel whilst inserting
his head up his arse.


Yes, I see that you did. It's pathetic code, but there it is. I missed it
amidst the flurry of flames that you've posted. What's the point of using
a FOR NEXT structure when you manage the iterator index yourself. That's a
nice way to obfuscate a perfectly simple algorithm. But I guess that you're
satisfied to get something working at all, regardless of the technique.
Still wishing for a GOTO to simplify your code?


Nov 20 '05 #47

"Nak" <a@a.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I'm still waiting for your code.


LOL! Your utter stupidity makes me crawl inside of my very skin, are you
feeling a tad on the sexually frustrated side? Again Jack, just for your
benefit, pull your head out of your arse and look, I submitted it in the
form of a zip, to which I received a warm reply, one of which you will
probably never receive with an attitude like that!


Tell your shrink that you're projecting your emotions again.
Nov 20 '05 #48
My former boss, an old-timer from a small town in Montana, had many words of
wisdom. One that I'll always remember is, "don't get into a pissing contest
with a skunk."

What's the point in a flamewar over who's the biggest jerk? (I think the
answer's obvious to everyone except Jack.)

Cor and Nak pointed Tom in the right direction. Several hours ago, Tom
replied "problem solved." What's the point in continuing this thread?

"Nak" <a@a.com> wrote in message
news:O3*************@TK2MSFTNGP11.phx.gbl...
It seems pointless to discuss anything here with you. You're more
interested in flaming than code, pseudo or real.
And you know the meaning of the word discuss do you Jack?

I think we may have just found the god of programmers,

All bow to Jack,
He is the ultimate coder,
The master blaster of basic,
The perfectionist of polymorphism,
The Jack of all,
and the master of none.

Nick.

--

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Nov 20 '05 #49
Cor
Nick,
Your code is not on every newsserver, but when you see the answer from Tom,
you can see you did send it via a newsgroup.
The code from mr Padawan works.
But he is using a selfmade index in a while loop.
I thought it would be something as
In psuedo code
Do While panel.count > 0
remove(0)
loop
What we see is a program from just behind the goto's time.
Cor
Nov 20 '05 #50

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

Similar topics

6
by: Qun Cao | last post by:
Hello, I am just starting to play threading in python, here is a really interesting problem I am very curious about: " import thread def main(): thread.start_new(test.()) def test():
0
by: Niranjan | last post by:
Access XP Windows XP This code has been working for over 5 years with no problems and all of a sudden I am running into these wierd problems. I have this code to delete a record....
1
by: paul reed | last post by:
Hello, I am having some weird behavior between two machines...one which is running the 1.1 framework and one which is running 1.0. After opening a child form from a parent...I update the...
3
by: Michael Loughry | last post by:
I'm working for a company in Houston developing a web application. At one point in the code, we have to refresh the page, but save what checkboxes have been selected. Since these checkboxes are...
14
by: SStory | last post by:
I am trying to make a splash screen for my vb.net app. It is an mdi app. including the splash code produces wierd results. not inluding makes things fine. Also have tried loading the splash...
0
by: Tom | last post by:
OK, here's a wierd one... I have a listbox, which I fill with strings (in my case, file names). I normally load this via a loop, adding each item to the list box in the loop. I put lb.BeginUpdate...
3
by: Tom | last post by:
We are experiencing some wierd debugging behavior. What happens is that, during debugging with VS 2003, the debugger seems to 'skip' statements that are associated with database operations. For...
0
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number...
4
by: Muthu Arumugam | last post by:
Tried the following c# code static void Main(string args) { ArrayList list = new ArrayList(); int i = 10;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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

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