Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question
Message
From
06/07/2010 08:55:32
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Newbie question
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01471507
Message ID:
01471507
Views:
130
Here's a newbie C#

I could write the code below in a few lines in VFP

This isn't so bad but now now I have a similar situation with 52 values

What's the best way to do this in VS 2008? (not VS 2010)
 switch (column)
        {
        case 0:
          textBoxColumn1.Text = stack[column, row].ToString();
          textBoxColumn1.ForeColor = textboxforecolor; 
          break;
        case 1: 
           textBoxColumn2.Text = stack[column, row].ToString();
           textBoxColumn2.ForeColor = textboxforecolor; 
          break;
        case 2:
          textBoxColumn3.Text = stack[column, row].ToString();
          textBoxColumn3.ForeColor = textboxforecolor; 
           break;
        case 3:
          textBoxColumn4.Text = stack[column, row].ToString();
          textBoxColumn4.ForeColor = textboxforecolor; 
   
          break;
        case 4:
          textBoxColumn5.Text = stack[column, row].ToString();
          textBoxColumn5.ForeColor = textboxforecolor; 
   
          break;
        case 5:
          textBoxColumn6.Text = stack[column, row].ToString();
          textBoxColumn6.ForeColor = textboxforecolor; 
          break;
        case 6:
          textBoxColumn7.Text = stack[column, row].ToString();
          textBoxColumn7.ForeColor = textboxforecolor; 
         break; 
        } 
     
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Next
Reply
Map
View

Click here to load this message in the networking platform