Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Regarding swagger API 1 38
Coding for the first time 9 70
VB.net Filesystem watcher not working 5 38
Return array 3 20
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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