Thread: Passing from functions in classes to another function in another class?

  1. #1
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Unhappy Passing from functions in classes to another function in another class?

    Hey folks,

    I've got meself a problem. Pretty annoying one at that.

    Well, I'm playing around with a newbie program that I want to make to display junk files in a listBox.
    When I use the functions and everything in the same class everything works well (all the files are
    correctly displayed in the listbox). Well, that's all good but now I want to seperate the code into
    seperate classes to ease down on the eyestrain.

    I've made a function one the main form in my program to read strings sent to it by another function in another
    class, and then to add the information into the listBox1:


    Here is the button label I'm using:

    Code:
    private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
    {
    //IEBrowser Cache
    SysClean.IClean.IECache test = new IECache();
    test.IECacheRun();
    }
    Here is the sample from my main form:

    Code:
    public void LB1Add(System.String Received)
    {
    System.String Add;
    Add = Received;
    listBox1.Items.Add(Add); //Doesn't work, my test text won't enter
    }
    Here is the sample from the form from which I'm sending information:

    Code:
    public void IECacheRun()
    {
    System.String send;
    send = "The contents of your cache file (index.dat) is listed below:";
    SysClean.IClean.IClean SendFunc = new IClean();
    SendFunc.LB1Add(send);
    }
    The funny thing is is that a StreamWriter code can read the text in place of listBox1.Items.Add and add it to
    a text file...
    Can you figure this out? I've taken 2 hours at breaking blood vessels in my brain trying to, maybe you can
    save me from completely going nutso and start talking to myself?!?! PLEASE
    Oh, ps, using VC# 2003, not Borland

    Thanks,

    Rob Sitter
    [Professional at novice]

  2. #2
    Master At Novice
    Join Date
    Oct 2005
    Location
    Cardassia & Canada, eh!
    Posts
    31

    Smile Replying to anyone who sends feedback

    I've decided to just go along with StreamWriter as I'm using a Save option to save the file anyway, may as well just read from it if it's already there.

    I see the number of views on this post was high, thanks for looking anyhow

    Rob Sitter
    [Professional at Novice]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-17-2008, 01:00 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  4. Passing functions by value in a class...
    By Sebastiani in forum C++ Programming
    Replies: 3
    Last Post: 05-30-2002, 05:57 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM