Text problem

From: Trond (thoiberg_at_broadpark.no)
Date: 11/03/04


Date: Wed, 3 Nov 2004 22:16:04 +0100

First i must say i am sorry for the repost. I noticed to late that i forgot
to add text in the subject field.

I made a class that has one purpose. That is to read a log file into an
array and provide methods to get a random line. In the code below I am using
GetHeaderFromFiles to build up the array. In getDateStart i am picking out
line 2 from the array. When i in some form try to set a textbox.text like
this it does not work :
-----------------------------------------
LogHead test = new LogHead();
txtDate.Text = test.getDateStart();
-------------------------------------------
Here is the class LogHead

public static string GetHeaderFromFile(string filename, int linenr)
{
StreamReader f = new StreamReader(filename);
ArrayList lines = new ArrayList();
string line;
while ((line = f.ReadLine()) != null)
lines.Add(line);
return lines[linenr].ToString();
}
public static string getDateStart()
{
string theDate=GetHeaderFromFile(@"C:\Log\log.dat", 2);
return theDate;
}

As a newbee i am wondering why this does not work and if someone has some
tip that can help
me.
Best regards



Relevant Pages

  • Re: Text problem
    ... That is to read a log file into an> array and provide methods to get a random line. ... > LogHead test = new LogHead; ... > public static string GetHeaderFromFile ... > public static string getDateStart() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: iterating through an array of Strings
    ... You named this variable an array, but didn't declare it as one. ... public static String[] data; ... String doesn't declare an array of Strings, it declares an array of String. ... you are grabbing array elements. ...
    (comp.lang.java.help)
  • GetFields not working on enum type (anymore)
    ... I have a method that takes a type that relates to an enum and then gets ... GetFields only ever returns a zero length array. ... public static string[] GetEnumDescriptions ... ReturnNames = Temp; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: byte[] to string conversion ...
    ... public static string ByteArrayToString(byte[] array) ... string str = null; ... ascii.GetChars(array, 0, array.Length, asciiChars, 0); ...
    (microsoft.public.dotnet.languages.csharp)

Quantcast