Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
GeneralRe: Image rotation Pin
azusakt9-Jul-03 15:35
azusakt9-Jul-03 15:35 
GeneralRe: Image rotation Pin
Valeria Bogdevich9-Jul-03 20:03
Valeria Bogdevich9-Jul-03 20:03 
GeneralUser Control Property Pin
Tym!8-Jul-03 11:08
Tym!8-Jul-03 11:08 
Generaltransparent user control issue Pin
SimonS8-Jul-03 10:43
SimonS8-Jul-03 10:43 
GeneralSerialization Question Pin
monrobot138-Jul-03 10:01
monrobot138-Jul-03 10:01 
GeneralRe: Serialization Question Pin
Kastro8-Jul-03 17:37
Kastro8-Jul-03 17:37 
GeneralRe: Serialization Question Pin
monrobot139-Jul-03 2:44
monrobot139-Jul-03 2:44 
GeneralStackOverflowException Pin
zuhx8-Jul-03 9:55
zuhx8-Jul-03 9:55 
I get a StackOverFlowException when I try to assign values in an array to properties in a struct. Not sure what is going on, any one have any ideas? Here is the code:

//Main Class
public class BloombergEq
{
TradeData td = new TradeData();
public BloombergEq()
{
}

public ArrayList ExecuteTradeData()
{
string fileName = @"D:\CSharp\file2.txt";
ArrayList rows = new ArrayList();

try
{
FileStream bbFile = new FileStream(fileName, FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(bbFile);

//Move the file cursor down 4 lines to get to start of data
sr.ReadLine();
sr.ReadLine();
sr.ReadLine();
sr.ReadLine();

while (sr.Read() != -1)
{
object[] tokens = new object[12];
int tokenIndex = 0;

string row = sr.ReadLine();
Regex r = new Regex("\\s(?=([^\"]*\"[^\"]*\")*(?![^\"]*\"))"); //matches all white space characters

//splits line at every white space
//disregards whitespaces & saves non-whitespace char
for (int i=0; i<=r.Split(row).Length-1;i++)
{
if(r.Split(row).GetValue(i).Equals(""))
{
continue;
}
else
{
tokens[tokenIndex] = r.Split(row).GetValue(i);
tokenIndex++;
}
} // for

Console.WriteLine(tokens[0]);
THIS IS WHERE THE ERROR IS THROWN
td.orderTime = tokens[0];
td.transactionType = (string)tokens[1];
td.ticker = (string)tokens[3];
td.price = (float)tokens[4];
td.fillQ = (float) tokens[6];
td.account = (string)tokens[7];
td.broker = (string)tokens[8];
td.status = (string) tokens[9];
rows.Add(td);
} //while
}
catch (Exception e)
{
Console.WriteLine(e);
}

return rows;
} //ExecuteTradeData

public static void Main(string[] args)
{
BloombergEq eq = new BloombergEq();
eq.ExecuteTradeData();
}
} //BloombergEq

//struct
public struct TradeData
{
public object orderTime
{
get
{
return orderTime;
}
set
{
orderTime = value;
}
}

public string transactionType
{
get
{
return transactionType;
}
set
{
transactionType = value;
}
}

public string ticker
{
get
{
return ticker;
}
set
{
ticker = value;
}
}

public float price
{
get
{
return price;
}
set
{
price = Convert.ToSingle(value);
}
}
public float fillQ
{
get
{
return fillQ;
}
set
{
fillQ = Convert.ToSingle(value);
}
}
public string account
{
get
{
return account;
}
set
{
account = value;
}
}

public string broker
{
get
{
return broker;
}
set
{
broker = value;
}
}

public string status
{
get
{
return status;
}
set
{
status = value;
}
}
} //struct
GeneralRe: StackOverflowException Pin
Andy Smith8-Jul-03 10:19
Andy Smith8-Jul-03 10:19 
GeneralRe: StackOverflowException Pin
leppie8-Jul-03 13:38
leppie8-Jul-03 13:38 
GeneralRe: StackOverflowException Pin
Anonymous8-Jul-03 18:35
Anonymous8-Jul-03 18:35 
GeneralRe: StackOverflowException Pin
Andy Smith8-Jul-03 18:58
Andy Smith8-Jul-03 18:58 
GeneralI've looked everywhere Pin
mdolby8-Jul-03 8:54
mdolby8-Jul-03 8:54 
GeneralRe: I've looked everywhere Pin
Nathan Blomquist8-Jul-03 9:19
Nathan Blomquist8-Jul-03 9:19 
GeneralPossible creation of comp.std.cli and comp.std.csharp Pin
Eric Gunnerson (msft)8-Jul-03 8:23
Eric Gunnerson (msft)8-Jul-03 8:23 
GeneralClickety Police Pin
leppie8-Jul-03 9:07
leppie8-Jul-03 9:07 
GeneralMaking one user control aware of another Pin
frogb0x8-Jul-03 7:57
frogb0x8-Jul-03 7:57 
GeneralRe: Making one user control aware of another Pin
leppie8-Jul-03 8:34
leppie8-Jul-03 8:34 
GeneralRe: Making one user control aware of another Pin
Not Active8-Jul-03 9:54
mentorNot Active8-Jul-03 9:54 
GeneralHere's my code so far Pin
frogb0x8-Jul-03 10:32
frogb0x8-Jul-03 10:32 
GeneralRe: Here's my code so far Pin
leppie8-Jul-03 13:34
leppie8-Jul-03 13:34 
GeneralRe: Here's my code so far Pin
frogb0x8-Jul-03 13:35
frogb0x8-Jul-03 13:35 
GeneralRe: Here's my code so far Pin
leppie8-Jul-03 14:05
leppie8-Jul-03 14:05 
GeneralSetting form location Pin
mcgahanfl8-Jul-03 7:32
mcgahanfl8-Jul-03 7:32 
GeneralRe: Setting form location Pin
dynamic8-Jul-03 9:40
dynamic8-Jul-03 9:40 

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.