Click here to Skip to main content
16,011,998 members
Home / Discussions / C#
   

C#

 
GeneralRe: listviews losing background color Pin
surshbabuk13-Jun-06 18:03
surshbabuk13-Jun-06 18:03 
GeneralRe: listviews losing background color Pin
acezrwild81714-Jun-06 2:21
acezrwild81714-Jun-06 2:21 
GeneralRe: listviews losing background color Pin
Dustin Metzgar14-Jun-06 2:34
Dustin Metzgar14-Jun-06 2:34 
GeneralRe: listviews losing background color Pin
acezrwild81714-Jun-06 8:13
acezrwild81714-Jun-06 8:13 
QuestionDll Question Pin
teejayem13-Jun-06 14:28
teejayem13-Jun-06 14:28 
AnswerRe: Dll Question Pin
urbane.tiger13-Jun-06 16:28
urbane.tiger13-Jun-06 16:28 
GeneralRe: Dll Question Pin
teejayem14-Jun-06 14:12
teejayem14-Jun-06 14:12 
GeneralRe: Dll Question Pin
teejayem14-Jun-06 15:15
teejayem14-Jun-06 15:15 
Hey pjd i tested out what you gave me and i tried it out but i'm having a few problems. If you could help me out that would be great!


On the mainfrm it isn't giving me the option to add the delegate "TextSender". Once i get that i should be fine with the app part of it. What i would want to put here is textReader.TextSender = ProcessText;

public partial class mainfrm : Form
{

    public mainfrm()
    {
        InitializeComponent();
    }

    private void rfButton_Click(object sender, EventArgs e)
    {
        OpenFileDialog open = new OpenFileDialog();

        open.Title = "Select A Text File";
        open.InitialDirectory = @"C:\";
        open.Filter = "Supported Files|*.txt";
        open.Multiselect = false;
        open.ReadOnlyChecked = false;

        if (open.ShowDialog() == DialogResult.OK)
        {
            foreach (string filename in open.FileNames)
            {
                textRead.ReadText(open.FileName);
            }
        }
    }
    private void ProcessText(string text)
    {
        textBox1.Text = text;
        textBox1.Invalidate();
    }
 }

The compiler complains when i try to add this.TextSender(sr.ReadLine()) giving the message below. But I need to have that method static so i can call it from the mainfrm (as shown above).
public class textRead
{
    public delegate void AddText(string text);
    public AddText TextSender
    {
        get
        {
            return TextSender;
        }
        set
        {
            TextSender = value;
        }
    }

    public static void ReadText(string source)
    {
        using (StreamReader sr = new StreamReader(source))
        {
            this.TextSender(sr.ReadLine());
            //^Keyword 'this' is not valid in a static property, static method, or static field initializer
        }
    }
}



Thanks again for your help!

Don't be overcome by evil, but overcome evil with good
GeneralRe: Dll Question Pin
urbane.tiger15-Jun-06 20:13
urbane.tiger15-Jun-06 20:13 
GeneralRe: Dll Question Pin
teejayem16-Jun-06 6:50
teejayem16-Jun-06 6:50 
AnswerRe: Dll Question Pin
Filip van der Meeren13-Jun-06 23:46
Filip van der Meeren13-Jun-06 23:46 
Questionreports Pin
kjosh13-Jun-06 11:44
kjosh13-Jun-06 11:44 
JokePlug Pin
Nicholas Butler13-Jun-06 13:25
sitebuilderNicholas Butler13-Jun-06 13:25 
QuestionAccess form objects from a class Pin
Ramjet113-Jun-06 11:25
Ramjet113-Jun-06 11:25 
AnswerRe: Access form objects from a class Pin
Member 9613-Jun-06 12:12
Member 9613-Jun-06 12:12 
AnswerRe: Access form objects from a class Pin
urbane.tiger13-Jun-06 17:00
urbane.tiger13-Jun-06 17:00 
QuestionSystem.String and Thread Safety Pin
Alexander Wiseman13-Jun-06 11:05
Alexander Wiseman13-Jun-06 11:05 
AnswerRe: System.String and Thread Safety Pin
User 665813-Jun-06 11:17
User 665813-Jun-06 11:17 
GeneralRe: System.String and Thread Safety Pin
Alexander Wiseman13-Jun-06 11:28
Alexander Wiseman13-Jun-06 11:28 
GeneralRe: System.String and Thread Safety Pin
Leslie Sanford13-Jun-06 11:40
Leslie Sanford13-Jun-06 11:40 
GeneralRe: System.String and Thread Safety [modified] Pin
Alexander Wiseman13-Jun-06 11:46
Alexander Wiseman13-Jun-06 11:46 
GeneralRe: System.String and Thread Safety [modified] Pin
Leslie Sanford13-Jun-06 11:58
Leslie Sanford13-Jun-06 11:58 
AnswerRe: System.String and Thread Safety [modified] Pin
Leslie Sanford13-Jun-06 11:44
Leslie Sanford13-Jun-06 11:44 
GeneralRe: System.String and Thread Safety Pin
Alexander Wiseman13-Jun-06 11:52
Alexander Wiseman13-Jun-06 11:52 
AnswerRe: System.String and Thread Safety Pin
Guffa13-Jun-06 11:46
Guffa13-Jun-06 11:46 

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.