|
-
Oct 26th, 2010, 06:54 AM
#1
Thread Starter
PowerPoster
Communication between forms
I'm designing a program that will display share quotes and share information. Currently I have my main form and 2 additional forms (frmStockQuotes and frmStockInfo). The main form, every 30 seconds will go off to a website and get the share quotes and information for all the stocks listed in frmStockQuotes and frmStockInfo.
My issue/question is, how to I pass all the stock codes from frmStockQuotes and/or frmStockInfo to my main form and once received from both (or one if only one of the forms are open) go off and get all the info from the web? Once all the info is retrieved how would I pass the info back to each form?
Once I have this example complete I will be adding additional forms which will do the same thing so I could have 10 forms open that all need to send their stock lists back to the main form before the share info is retrieved.
Any help would be appreciated
-
Oct 26th, 2010, 10:08 AM
#2
Re: Communication between forms
You can use Properties or Delegates (I would probably go with the second) - take a look at samples posted here.
-
Oct 27th, 2010, 10:13 AM
#3
Fanatic Member
Re: Communication between forms
I think I'd create a class with public properties. each of the stocks has similar properties such as the ticker, Last Trade, PrevClose, Open, Bid, Ask etc etc.
Programmitically you'd then create an array of Stocks and you could read and write to them like this:-
myStock[i].ticker = "RIO.L";
myStock[i].LastTrade = 4047.50;
myStock[i].Open = 4070.00
etc. etc.
Because they're in a public class you could get at them from any form.
or something like that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|