HighTechTalks DotNet Forums  

newbie question, working with array

Dotnet FAQs microsoft.public.dotnet.faqs


Discuss newbie question, working with array in the Dotnet FAQs forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jurgen Oerlemans
 
Posts: n/a

Default newbie question, working with array - 02-14-2006 , 03:47 AM






Hello,

Being fairly new to vb (dotnet) programming, I have the following question:

I have 10 buttons from which I want to change background color, text
etcetera. Instead of making 10 lines of programming code I want to do this
by using an array. So what I tried is:
Dim btnArray As String() = {"btnfirst", "btnsecond", "btnthird", etcetera}

Dim S As String

For Each S In btnArray

S.BackColor = System.Drawing.Color.OrangeRed

Next



This doesn't work. Can anybody put me on the right track? Shouldn't be so
hard I think. Any help appreciated.

Regards, Jurgen



Reply With Quote
  #2  
Old   
Nick Hounsome
 
Posts: n/a

Default Re: newbie question, working with array - 02-14-2006 , 05:11 AM







"Jurgen Oerlemans" <jurgen.oerlemans (AT) envirolab_remove_ (DOT) nl> wrote

Quote:
Hello,

Being fairly new to vb (dotnet) programming, I have the following
question:

I have 10 buttons from which I want to change background color, text
etcetera. Instead of making 10 lines of programming code I want to do this
by using an array. So what I tried is:
Dim btnArray As String() = {"btnfirst", "btnsecond", "btnthird",
etcetera}

Dim S As String

For Each S In btnArray

S.BackColor = System.Drawing.Color.OrangeRed

Next



This doesn't work. Can anybody put me on the right track? Shouldn't be so
hard I think. Any help appreciated.

Regards, Jurgen
Buttons are buttons and strings are strings duh!

....
Dim btnArray as Button() = { btnfirst, btnsecond };
....
Dim S as Button
....




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.