Solved

C# Windows App VS2008 - Problem with passing values to a static method?

Posted on 2008-06-17
1
208 Views
Last Modified: 2013-12-16
C# Windows App VS2008 - Problem with passing values to a static method?

I have one class that I want to pass a string to a method in another classes textbox. When I make the method in the other class static I can see it but with the method it wont see its own textbox (txtMyBox). When I make the method non static it can see the textbox but the other class cannot see the method?!

Seems like a catch 22? Any help appreciated. I suspect fundametal failure to comprehend. See some attached code if it helps.


Tring to call the method...
 
frmUnmigrated.reportUnmigarted(unmigratedFiles.ToString());
 
trying to pass to this method in second class but when static wont see its own form objects (trying to update a textbox)
 
namespace Share_Check
{
    public partial class frmUnmigrated : Form
    {
        public frmUnmigrated()
        {
            InitializeComponent();
            Global.frmUnmigratedRef = this;
        }
        public static String reportUnmigarted(String files)
        {
            // <<<<-------- I want to put txtBox.Text = files; here but NO!! wont see the text box
            return "Done";
        }
        
    }
}

Open in new window

0
Comment
Question by:Karl66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Karl66 earned 0 total points
ID: 21807237
I ended up having to do this...

        public static String reportUnmigrated(String files)
        {
            Share_Check.Global.frmUnmigratedRef.txtUnmigrated.Text = files;
            return "Done";
        }
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question