Solved

Show statement

Posted on 1999-01-04
8
138 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
  • 3
  • 3
  • 2
8 Comments
 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now