PC Review


Reply
Thread Tools Rate Thread

can I use a for loop or foreach here

 
 
Tony Johansson
Guest
Posts: n/a
 
      4th Apr 2009
Hello!

This btn1,btn2,btn3 and btn4 is button controls.
I just wonder is it possible to use a for loop or foreach instead of these
four rows so the number of rows is reduced in the code.

private void setTextOnBtn()
{
btn1.Text = vector[1].ToString();
btn2.Text = vector[2].ToString();
btn3.Text = vector[3].ToString();
btn4.Text = vector[4].ToString();
}

//Tony


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Last row in foreach loop tshad Microsoft C# .NET 37 12th Apr 2011 12:52 PM
foreach-loop bug in CF2.0? c_xyTopa Microsoft Dot NET Compact Framework 9 24th Jan 2008 02:51 PM
Foreach loop Robert Bravery Microsoft C# .NET 7 23rd Jul 2006 04:35 PM
foreach loop Mike P Microsoft C# .NET 5 26th Nov 2004 01:19 PM
I have a bug in foreach loop Alvin Bruney Microsoft C# .NET 13 1st Nov 2003 02:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:43 PM.