Click here to Skip to main content
15,899,937 members
Home / Discussions / C#
   

C#

 
AnswerRe: New to C# Programming Pin
George L. Jackson24-Aug-07 14:02
George L. Jackson24-Aug-07 14:02 
Newsyou guys rock Pin
invalidsyntax101024-Aug-07 15:54
invalidsyntax101024-Aug-07 15:54 
AnswerRe: New to C# Programming Pin
Thomas Stockwell25-Aug-07 2:31
professionalThomas Stockwell25-Aug-07 2:31 
GeneralRe: New to C# Programming Pin
George L. Jackson25-Aug-07 3:12
George L. Jackson25-Aug-07 3:12 
Question(nOOb help) comparing ArrayLists of structs.. Pin
Dio2224-Aug-07 9:43
Dio2224-Aug-07 9:43 
AnswerRe: (nOOb help) comparing ArrayLists of structs.. Pin
ghle24-Aug-07 11:08
ghle24-Aug-07 11:08 
AnswerRe: (nOOb help) comparing ArrayLists of structs.. Pin
Luc Pattyn24-Aug-07 13:37
sitebuilderLuc Pattyn24-Aug-07 13:37 
QuestionHow do I incorporate these two routines? Pin
solutionsville24-Aug-07 9:21
solutionsville24-Aug-07 9:21 
I am very new and trying to do something very advanced.

Can you open a file with StreamReader, format with StringBuilder, and then pass the results of the StringBuilder to a StringCollection? or am I out of my mind.


Here is my StringBuilder routine;

----------------------------------
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
bool firstLine = true;
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Trim() == "")
continue;
if (line.Length < 29) { throw new InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
int txPos;
int rxPos = -1;
int len = 0;
if (firstLine)
firstLine = false;
else
sb.Append("\r\n");
if (((txPos = line.IndexOf("TX")) > -1) || ((rxPos = line.IndexOf("RX")) > 0))
{
int charactersTillPoint;
if (txPos > -1)
{
charactersTillPoint = txPos;
len = line.Substring(txPos).Length;
}
else
{
charactersTillPoint = rxPos;
len = line.Substring(rxPos).Length;
}
string part0 = line.Substring(0, charactersTillPoint);
string part1 = line.Substring(charactersTillPoint);
sb.Append(part0.PadRight(86));
sb.Append(part1);
}
else
sb.Append(line);
sb.Append(' ');
if (len == 12)
sb.Append(' ');
}
else
{
sb.Append(line.Substring(31));
}
}
return sb.ToString();
}
#endregion
}
----------------------------------
And here is my StringCollection Routine;
----------------------------------
StringCollection ReadFileIntoStringCollection()
{
const int MaxBytes = 65536;
StreamReader sr = new StreamReader(chosenFile);
StringCollection result = new StringCollection();
int nBytesRead = 0;
string nextLine;
while ((nextLine = sr.ReadLine()) != null)
{
nBytesRead += nextLine.Length;
if (nBytesRead > MaxBytes)
break;
result.Add(nextLine);
}
sr.Close();
return result;
----------------------------------
AnswerRe: How do I incorporate these two routines? Pin
Hessam Jalali24-Aug-07 9:55
Hessam Jalali24-Aug-07 9:55 
AnswerRe: How do I incorporate these two routines? Pin
solutionsville24-Aug-07 10:16
solutionsville24-Aug-07 10:16 
AnswerRe: How do I incorporate these two routines? Pin
Big Daddy Farang24-Aug-07 12:37
Big Daddy Farang24-Aug-07 12:37 
AnswerRe: How do I incorporate these two routines? [modified] Pin
solutionsville24-Aug-07 17:54
solutionsville24-Aug-07 17:54 
GeneralRe: How do I incorporate these two routines? Pin
Big Daddy Farang27-Aug-07 10:03
Big Daddy Farang27-Aug-07 10:03 
AnswerRe: How do I incorporate these two routines? Pin
solutionsville27-Aug-07 12:32
solutionsville27-Aug-07 12:32 
GeneralRe: How do I incorporate these two routines? Pin
Big Daddy Farang27-Aug-07 12:39
Big Daddy Farang27-Aug-07 12:39 
Questiongetting infragistics Pin
starist24-Aug-07 9:12
starist24-Aug-07 9:12 
AnswerRe: getting infragistics Pin
Alaric_24-Aug-07 9:27
professionalAlaric_24-Aug-07 9:27 
GeneralRe: getting infragistics Pin
Dan Neely24-Aug-07 10:06
Dan Neely24-Aug-07 10:06 
QuestionI need a full stop Pin
humayunlalzad24-Aug-07 8:41
humayunlalzad24-Aug-07 8:41 
AnswerRe: I need a full stop Pin
PIEBALDconsult24-Aug-07 9:04
mvePIEBALDconsult24-Aug-07 9:04 
GeneralRe: I need a full stop Pin
Alaric_24-Aug-07 9:05
professionalAlaric_24-Aug-07 9:05 
AnswerRe: I need a full stop Pin
Alaric_24-Aug-07 9:04
professionalAlaric_24-Aug-07 9:04 
AnswerRe: I need a full stop Pin
PIEBALDconsult24-Aug-07 11:58
mvePIEBALDconsult24-Aug-07 11:58 
GeneralRe: I need a full stop Pin
martin_hughes24-Aug-07 11:49
martin_hughes24-Aug-07 11:49 
GeneralRe: I need a full stop Pin
humayunlalzad24-Aug-07 14:55
humayunlalzad24-Aug-07 14:55 

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.