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

x
?
Solved

How to generate a key and add it to status bar panel?

Posted on 2002-05-17
6
Medium Priority
?
179 Views
Last Modified: 2010-05-02
I have a status bar with 8 panels.
Because a user can change profile this is loaded several times.

Now wherever it loads it finds an error.
Key not unique in collection.

Now since at the stage that this happen I cannot add a key
that is something I can retrieve from the database like a primary key.

I thought of adding a count to it but doesnt work

my idea
dim count as integer
count =0


dim panel as panel

set panel=stbmdipanels.panels.add(,"Bookings" & Count,"Bookings)
count=count + 1

but this doesnt work because whenever it loads again it fails.
any suggestions?

Thanks
Gabriel





0
Comment
Question by:Gabriel_Brienza
[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
6 Comments
 
LVL 3

Expert Comment

by:Bahnass
ID: 7018016
if I understand U need Static Var in a procedure



Static Conut        ' instead of Dim Count

'     Basic Initialize it  to 0 automatically
0
 
LVL 4

Accepted Solution

by:
Monchanger earned 200 total points
ID: 7018422
> Because a user can change profile this is loaded several times.

I'm not sure understood this correctly, but are you adding panels to the *same instance* of the statusbar whenever a new user logs in? If so, they would indeed hold the same key and give you a runtime error. (If your application is small, I believe this would be the cause)

Instead, you could rebuild the statusbar when a user logs in - first remove all existing panels, and then creating new panels (it would be more efficient to fix the old panels, but that depends on your needs)

Something like:

Private Sub RebuildStatusBar()
    StatusBar1.Panels.Clear
   
    StatusBar1.Panels.Add , "Panel1", "First Panel"
    StatusBar1.Panels.Add , "Panel2", "Second Panel"
End Sub

0
 

Author Comment

by:Gabriel_Brienza
ID: 7020959
Thanks guys for your replys

I have tried to add a static count and didnt work

I did

static AddKey as integer

Dim Panel As Panel
 addKey=addkey + addkey              

set Panel = stbMDI.Panels.Add, "Bookings" + addkey, "Bookings")
     
but this didnt work and I cannot understand why


also i tried to remove it and the add it but it keeps saying element not found which means.

I need to find a way first if it exist and if does remove and add it.

Any suggestions how to do it?

Thanks
Gabriel

   
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 4

Expert Comment

by:Monchanger
ID: 7023311
The Panels.Clear should remove all of the panels.

Maybe if you posted your code we'd understand why it doesn't work for you.
0
 

Author Comment

by:Gabriel_Brienza
ID: 7023466
Thanks for your help
I have solved the problem.

0
 
LVL 1

Expert Comment

by:kevman63
ID: 7194230
the panel's KEY MUST not be a number.  it HAS to start with a text character.  i know this question is answered, but i found this very useful to know.
0

Featured Post

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.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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