[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Show statement

Posted on 1999-01-04
8
Medium Priority
?
151 Views
Last Modified: 2010-05-03
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
Comment
Question by:hpet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 13

Accepted Solution

by:
Mirkwood earned 200 total points
ID: 1453753
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
 
LVL 1

Author Comment

by:hpet
ID: 1453754
no "work arround" at all?
nothing at all?
how about object declered as form and then using new statement?

Peter

0
 
LVL 15

Expert Comment

by:ameba
ID: 1453755
VB6 makes this possible. It has function CallByName
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 15

Expert Comment

by:ameba
ID: 1453756
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
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1453757
I thought that it was only possible in VBA?
But can you create another instance of the same form using the same method?
0
 
LVL 1

Author Comment

by:hpet
ID: 1453758
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
 
LVL 15

Expert Comment

by:ameba
ID: 1453759
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
 
LVL 1

Author Comment

by:hpet
ID: 1453760
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question