473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

returning values FROM window form

Hi all,

Quickie - I hope. I already know how to use a forms New() Sub to receive
parameters from a calling class - but I don;t know how to return values...

Anyone know the recommended method for doing this?

Thanks,
Graham
Jul 21 '05 #1
2 1576
Create some properties corresponding to each of those values, or create a
class that holds all of them and make a property of that class in your
target form.

Before that form closes, set them all...

this.FirstValueYouWantReturned = Whatever;
or me.FirstValueYouWantReturned = Whatever (vb.net)
and repeat this for each varaible. Assume these properties were added to
Form2.

So...

Form2 frm = new Form2(SomeValue, SomeOtherValue);//this means you passed in
two variables
frm.Show();

or Dim frm as Form2 = new Form2(SomeValue, SomeOtherValue)
frm.Show()

now, in form2 set those properties as I showed you above to the values you
want returned

string FirstValue = frm.FirstValueYouWantReturned;
string SecondValue = frm.SecondValueYouWantReturned;

same process for VB.NET at this point.

Or you coudl just create one property of type someClass that contains all of
the variables. Then you set them in the class (remember, it's still a
property of Form2 which is essential to either approach, this just
consolidates it).

then

string FirstValue = frm.SomeObject.FirstValueYouSet;
string SecondValue = frm.SomeObject.SecondValueYouSet;

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:aF*********************@news20.bellglobal.com ...
Hi all,

Quickie - I hope. I already know how to use a forms New() Sub to receive
parameters from a calling class - but I don;t know how to return values...

Anyone know the recommended method for doing this?

Thanks,
Graham

Jul 21 '05 #2
Thanks Bill.

I'll give it a try.
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
Create some properties corresponding to each of those values, or create a
class that holds all of them and make a property of that class in your
target form.

Before that form closes, set them all...

this.FirstValueYouWantReturned = Whatever;
or me.FirstValueYouWantReturned = Whatever (vb.net)
and repeat this for each varaible. Assume these properties were added to
Form2.

So...

Form2 frm = new Form2(SomeValue, SomeOtherValue);//this means you passed in two variables
frm.Show();

or Dim frm as Form2 = new Form2(SomeValue, SomeOtherValue)
frm.Show()

now, in form2 set those properties as I showed you above to the values you
want returned

string FirstValue = frm.FirstValueYouWantReturned;
string SecondValue = frm.SecondValueYouWantReturned;

same process for VB.NET at this point.

Or you coudl just create one property of type someClass that contains all of the variables. Then you set them in the class (remember, it's still a
property of Form2 which is essential to either approach, this just
consolidates it).

then

string FirstValue = frm.SomeObject.FirstValueYouSet;
string SecondValue = frm.SomeObject.SecondValueYouSet;

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
"Graham Blandford" <gr**************@sympatico.ca> wrote in message
news:aF*********************@news20.bellglobal.com ...
Hi all,

Quickie - I hope. I already know how to use a forms New() Sub to receive
parameters from a calling class - but I don;t know how to return values...
Anyone know the recommended method for doing this?

Thanks,
Graham


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Logger | last post by:
Help, Want someone's option. I'm calling a popup screen, say form B, to add/edit a record. In, say form A, I call form B using javascript window.open in server side code. I need to know when I...
2
by: Brian Henry | last post by:
If i have a window showing like this <script>window.showModalDialog('../weblinks/default.aspx','','unadorned:yes' );</script> how can i get it to return a value to its calling page? I want to...
3
by: User | last post by:
Form A (Main) Text Box 1 Text Box 2 Text Box 3 Form B (Pop-up) Choose a selection for Form A/Text Box 3 Scenario:
3
by: Graham Blandford | last post by:
Hi all, Quickie - I hope. I already know how to use a forms New() Sub to receive parameters from a calling class - but I don;t know how to return values... Anyone know the recommended method...
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
1
by: Curious Trigger | last post by:
Hi there, programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal dialog from Default.aspx. I searched the net and many newsgroups but I couldn't find any solution. First I...
6
by: vncntj | last post by:
I have this home.js file and I'm trying to collect the values on the other at "emplist.aspx" function poponload() { testwindow= window.open ("emplist.aspx", "mywindow",...
5
by: kosta.triantafillou | last post by:
Hi all, I have a form that contains a lot of values. On this form there are also alot of popups that can be brought up. One of them does the following: Takes 2 values (x and y), concatenates...
2
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
I've been developing an application using Visual Studio 2005 for a few months, and suddenly it is returning hex values in the watchlist when I'm stepping through code to debug. Is there some...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.