Solved

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

Posted on 2008-06-17
1
205 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System.Security 2 27
What is "public object" in C#? 3 45
performance tune IIS 10 on win 2016 that only runs one website 4 58
Hey!! 5 33
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 …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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