Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Not able to pass values back from method call

Posted on 2012-08-25
4
Medium Priority
?
735 Views
Last Modified: 2012-08-26
I have a Visual Studio 2010 Solution with 3 projects in it.  I do some backend processing in Project B and Project C, calling a method in each project from Project A.

I have several TextBoxes in Project A that I fill from the processing in Project C.  I pass those textboxes as parameters to the method in Project C, where I fill them in with data.

My problem is that the data does not get returned to the calling Project A.

Here is the call to the method in Project C from Project A:
GetBookInfo gbi = new GetBookInfo();
gbi.getBookInfo(mtbISBN.Text, tbTitle.Text, tbAuthor.Text, tbPub.Text);

Open in new window


Here is the code in Project C:
public bool getBookInfo(string isbn, string tbTitle, string tbAuthor, tbPub)  {

    parseReturnData(isbn, tbTitle, tbAuthor, tbPub);
return true;
}

private bool parseReturnData(string isbn, string title, string author, string pub)  {
   isbn = "12345";
   title = "blah, blah, blah";
   author = "me";
   pub = "hostPress";
  return true;

}

Open in new window

0
Comment
Question by:rmmarsh
  • 2
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 38332944
>>I pass those textboxes as parameters

Please post that code - your code given only passes the contents into the function.
0
 

Author Comment

by:rmmarsh
ID: 38332951
Andy:  I think that's the problem...  how do I pass the TextBoxes to the Project C so I can fill in the value and have it appear in Project A's main form?  Do I pass "(TextBox) tbName" to the method in Project C?
0
 

Author Closing Comment

by:rmmarsh
ID: 38333004
Thank you... that did it...
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 38333681
Basically yes - pass the textbox itself (by it's name).
You need to also look at and understand reference types and value types of objects.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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:…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

580 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