473,394 Members | 1,879 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,394 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
Nov 20 '05 #1
3 1086
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

Nov 20 '05 #2
* "Graham Blandford" <gr**************@sympatico.ca> scripsit:
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?


Add properties to the form and set the property values inside the form.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
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


Nov 20 '05 #4

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

Similar topics

2
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...
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:
0
by: GFro | last post by:
I have a calendar page that returns a date to a textbox on the parent page. It is returning the wrong format on the deployment server. On the development server the calendar returns to textbox in...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.