Click here to Skip to main content
15,907,392 members
Home / Discussions / C#
   

C#

 
AnswerRe: Incorrect syntax near the keyword 'Transaction' Pin
Curtis Schlak.23-Jul-09 18:07
Curtis Schlak.23-Jul-09 18:07 
GeneralRe: Incorrect syntax near the keyword 'Transaction' Pin
haleemasher23-Jul-09 18:10
haleemasher23-Jul-09 18:10 
AnswerRe: Incorrect syntax near the keyword 'Transaction' Pin
Mike Ellison23-Jul-09 18:09
Mike Ellison23-Jul-09 18:09 
QuestionFile Tansfer Protocols in VC# Pin
bigjoe11a23-Jul-09 16:50
bigjoe11a23-Jul-09 16:50 
QuestionHow do you store a bunch of values in a 20x20 array Pin
Nathan Revka23-Jul-09 15:20
Nathan Revka23-Jul-09 15:20 
AnswerRe: How do you store a bunch of values in a 20x20 array Pin
PIEBALDconsult23-Jul-09 15:34
mvePIEBALDconsult23-Jul-09 15:34 
GeneralRe: How do you store a bunch of values in a 20x20 array Pin
Nathan Revka23-Jul-09 17:06
Nathan Revka23-Jul-09 17:06 
AnswerRe: How do you store a bunch of values in a 20x20 array Pin
musefan23-Jul-09 22:08
musefan23-Jul-09 22:08 
Or, as you have your numbers nicely formatted, you could read them from a file and set in a couple of for loops...


using System.IO;

StreamReader sr = new StreamReader("inputfile.txt");
int[,] Grid = new int[20,20];

for(int i = 0; i < 20; i++)
{
     string line = sr.ReadLine();
     string[] vals = line.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
     for(int j = 0; j < 20; j++)
         Grid[i, j] = int.Parse(vals[j]);
}

sr.Close();



...A bit messy, but you get the idea. Also you will need to do some testing on the input file to make sure it contains correct data to avoid crash

Life goes very fast. Tomorrow, today is already yesterday.

AnswerRe: How do you store a bunch of values in a 20x20 array Pin
RugbyLeague23-Jul-09 23:11
RugbyLeague23-Jul-09 23:11 
Question[MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Don Marino23-Jul-09 10:35
Don Marino23-Jul-09 10:35 
AnswerRe: [MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Luc Pattyn23-Jul-09 12:04
sitebuilderLuc Pattyn23-Jul-09 12:04 
GeneralRe: [MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Don Marino24-Jul-09 1:27
Don Marino24-Jul-09 1:27 
GeneralRe: [MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Luc Pattyn24-Jul-09 1:37
sitebuilderLuc Pattyn24-Jul-09 1:37 
GeneralRe: [MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Don Marino24-Jul-09 3:32
Don Marino24-Jul-09 3:32 
GeneralRe: [MarshalAs()] attribute and Marshal.SizeOf() Issue Pin
Luc Pattyn24-Jul-09 12:41
sitebuilderLuc Pattyn24-Jul-09 12:41 
QuestionWhy do I get a "Cross thread" Exception? Pin
David8001C23-Jul-09 8:32
David8001C23-Jul-09 8:32 
AnswerRe: Why do I get a "Cross thread" Exception? Pin
Luc Pattyn23-Jul-09 8:41
sitebuilderLuc Pattyn23-Jul-09 8:41 
GeneralRe: Why do I get a "Cross thread" Exception? Pin
David8001C23-Jul-09 8:49
David8001C23-Jul-09 8:49 
GeneralRe: Why do I get a "Cross thread" Exception? Pin
Luc Pattyn23-Jul-09 9:03
sitebuilderLuc Pattyn23-Jul-09 9:03 
GeneralRe: Why do I get a "Cross thread" Exception? Pin
David8001C23-Jul-09 9:11
David8001C23-Jul-09 9:11 
GeneralRe: Why do I get a "Cross thread" Exception? Pin
Luc Pattyn23-Jul-09 9:21
sitebuilderLuc Pattyn23-Jul-09 9:21 
GeneralRe: Why do I get a "Cross thread" Exception? Pin
Luc Pattyn23-Jul-09 13:12
sitebuilderLuc Pattyn23-Jul-09 13:12 
AnswerRe: Why do I get a "Cross thread" Exception? Pin
PIEBALDconsult23-Jul-09 8:42
mvePIEBALDconsult23-Jul-09 8:42 
QuestionHow to copy assembly from GAC to local drive ? Pin
hdv21223-Jul-09 8:06
hdv21223-Jul-09 8:06 
AnswerRe: How to copy assembly from GAC to local drive ? Pin
Ian McCaul23-Jul-09 8:20
Ian McCaul23-Jul-09 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.