[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Show statement

Hi,

I have a toolbar control and each of buttons on it cary some information. For example Button(1).Key caries information which form to show when you press it.
Now i am having difficulties on how to make it work with show statement.

like: <button.key>.show

how could i make it work?

thanks,
Peter
0
hpet
Asked:
hpet
  • 3
  • 3
  • 2
1 Solution
 
MirkwoodCommented:
I'm sorry
The only way to do it is using a select statement

select case button.key
 case "myform1":
       myform1.show
 case "myform2":
       myform2.show
end select
0
 
hpetAuthor Commented:
no "work arround" at all?
nothing at all?
how about object declered as form and then using new statement?

Peter

0
 
amebaCommented:
VB6 makes this possible. It has function CallByName
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
amebaCommented:
Well, I tried this in IDE. It worked
    Dim x As Form
    Set x = Forms.Add("Form2")
    x.Show

Perhaps, you can use this:

Private Function ShowAForm(FormName As String) As Form
    Set ShowAForm = Forms.Add(FormName)
    ShowAForm.Show
End Function

' usage in your Toolbar_Click
    ShowAForm(button.key)
0
 
MirkwoodCommented:
I thought that it was only possible in VBA?
But can you create another instance of the same form using the same method?
0
 
hpetAuthor Commented:
Thanks Ameba. It's working ok.
Thank for trying Mirkwood.
btw, i tried and it is possible to create multiple instances of same form using same method.

Thanks,
Peter

0
 
amebaCommented:
hpet, before you go too far using Forms.Add

It is confirmed VB6 bug. I thought it doesn't work compiled to native code in VB6.
But it also doesn't work compiled to p-code. The same is in VB5.
0
 
hpetAuthor Commented:
Thanks for warning. I almost did go too far with it.
Anyway i didn't plan to use it much so i can wait with it.
I just hope this wont be one more bug that will drag along versions like some others...

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now