Can't get one of the "monkeys" you were looking for to help you with this?
On 26 July 2011 13:17, Anthony Mayan wrote:
> I have a form with many buttons.
>
> I want to be able to set the text property of the textbox at runtime by
> string.
>
> ("Button" & i).Text = "Hello" 'Of course this doesn
If you're in the full framework, how about a control array?
If you're in the compact framework, maybe create a dictionary using
"Button1" etc as the key. Initialise this in the form constructor.
David
"If we can hit that bullseye, the rest of the dominoes
will fall like a house of cards... che
Create a collection of Button references and then reference the buttons via the
collection.
List buttons = new List(NUMBER_OF_BUTTONS);
buttons[0] = button0;
buttons[1] = button1;
...
buttons[i].Text = "Hello"
From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-
I assume you wanted VB.NET. If not, I can provide a better answer in C# if you
need it.
Try this:
For Each button In (From x In Me.GetAllControls(Me).OfType(Of Button)()
_
Where x.Name = "Button" & n _
Select x)
button.Text = t
Next
You need
James,
This may work but it would be incredibly slow. Better to use a
reference to access the control you want directly. eg something like
either Ben's or my previous post.
David
"If we can hit that bullseye, the rest of the dominoes
will fall like a house of cards... checkmate!"
-Zapp Branni
...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On
Behalf Of David Richards
Sent: Tuesday, 26 July 2011 15:46
To: ozDotNet
Subject: Re: Set property of texbox by name
James,
This may work but it would be incredibly slow. Better to use a
reference to access the control you want directly. eg
James Chapman-Smith wrote:
Hi David,
What do you mean by incredibly slow? How many buttons are we talking about?
I just did a test with 1000 buttons and it took 3.47 milliseconds. With 5000
buttons it was 16.78 milliseconds.
Did I miss something?
Cheers.
James.
I'm with you James.
I u
thank you guys :) great help as usual
Anthony
On Tue, Jul 26, 2011 at 11:59 PM, Les Hughes wrote:
> James Chapman-Smith wrote:
>
>> Hi David,
>>
>> What do you mean by incredibly slow? How many buttons are we talking
>> about?
>>
>> I just did a test with 1000 buttons and it took 3.47 millisec
gt; Sent: Tuesday, 26 July 2011 15:46
> To: ozDotNet
> Subject: Re: Set property of texbox by name
>
> James,
>
> This may work but it would be incredibly slow. Better to use a
> reference to access the control you want directly. eg something like
> either Ben's or my p
Behalf Of David Richards
Sent: Tuesday, July 26, 2011 10:25 PM
To: ozDotNet
Subject: Re: Set property of texbox by name
James,
That may not sound like much but what are you running your app on? I work
mainly in mobile devices and for the sake of a few hundred bytes of RAM in a
collection or
bject: Re: Set property of texbox by name
James,
That may not sound like much but what are you running your app on? I
work mainly in mobile devices and for the sake of a few hundred bytes
of RAM in a collection or dictionary, you can have code that runs
efficiently and uses far less battery
David,
When optimizing code then you will be looking for your best "bang for
buck" and focus on slow parts of an app.
In this case, we are not optimizing but selecting which code we are
about to write. If you have a choice or two pieces of code with
similar effort to implement both but one is mu
On Tue, Jul 26, 2011 at 11:59 PM, Les Hughes wrote:
> James Chapman-Smith wrote:
>>
>> Hi David,
>>
>> What do you mean by incredibly slow? How many buttons are we talking
>> about?
>>
>> I just did a test with 1000 buttons and it took 3.47 milliseconds. With
>> 5000 buttons it was 16.78 milliseco
On Thu, Jul 28, 2011 at 11:43 AM, David Richards
wrote:
> David,
>
> When optimizing code then you will be looking for your best "bang for
> buck" and focus on slow parts of an app.
>
> In this case, we are not optimizing but selecting which code we are
> about to write. If you have a choice or t
On 28 July 2011 11:24, DotNet Dude wrote:
> On Tue, Jul 26, 2011 at 11:59 PM, Les Hughes wrote:
>> James Chapman-Smith wrote:
>>>
>>> Hi David,
>>>
>>> What do you mean by incredibly slow? How many buttons are we talking
>>> about?
>>>
>>> I just did a test with 1000 buttons and it took 3.47 mill
Yep,
http://visualstudiomagazine.com/articles/2007/11/01/on-avoiding-tolower.aspx
although it's really only an issue outside of English/ascii. That said, if
you program for Unicode from the get go, you avoid a lot of code review
should you ever need to switch to Unicode/multi-cultural from asci
16 matches
Mail list logo