Use Copies of Forms

后端 未结 3 1451
无人及你
无人及你 2021-01-14 01:41

i have a form that pulls in data, crunches numbers, does things. it works perfectly.

the problem is the code is i can only access one market at a time and i want to

3条回答
  •  隐瞒了意图╮
    2021-01-14 02:41

    It's up to you to create Properties on the MarketForm that you can set externally, so that each instance relates to a specific Market. I've used MarketName but you'll have to figure out what makes sense in your case.

    Inside the code for MarketForm create something like this (you'll need to modify your existing code to use it instead of however you are currently picking a market)

    Public Property MarketName As String
    

    With object-oriented programming it is easy to create different instances of any object (Form in this case).

    Dim myMarketForm1 As New MarketForm
    myMarketForm1.MarketName = "Eastern"
    myMarketForm1.Show()
    
    Dim myMarketForm2 As New MarketForm
    myMarketForm2.MarketName = "Central"
    myMarketForm2.Show()
    `... and so on
    

提交回复
热议问题