• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Delete a button or label



Hi,

I have a map, and on this map, I have multiple buttons and labels. I have Delete option under Edit menu. When i click on delete, this is the skeleton that it gives to me:

Private Sub mnuEditDelete_Click()

End Sub


Since there is no index...how can I know which button or label i delete...
cmdbutton(0), .....cmdbuttton(x)
lblLabel(0),...lblLabel(x)



Thaks

0
TungVan
Asked:
TungVan
2 Solutions
 
gecko_au2003Commented:
When you click on delete on the menu do you want it to delete all buttons and or labels or are you just trying to delete one at a time, If you created the buttons and labels as a control array then you should be able to prompt the user with an input box prompting for which one you want deleting.

Basically make it so that the delete option in the menu is only enabled after they have clicked on one of the controls that are in the control array and then if they click on delete, then make it delete the last item they clicked on within the control array so if you had 10 buttons within a control array and then 10 labels within the control array, if they clicked on button(10) then you could have a public variable that stored the last item they clicked on ie

Public itmStore As Integer

Public Sub cmdButton_Click(Index As Integer)
itmStore = Index
End Sub

Private Sub mnuEditDelete_Click()
Delete cmdButton(itmStore) '< -- I am not sure of what the delete or remove command is but I am sure this will make sense
End Sub

The coding would be something like that but I am not sure of what the delete command would be exactly, but this should give you a good idea of what to do :)
0
 
sk33v3Commented:
If you mean in the VB IDE, in your properties window (I have mine on the right side of the screen) whatever object you have selected will be deleted. if you have multiple items selected then the name will obviously be displayed in the properties window.
0
 
TungVanAuthor Commented:

>sk33v3

I don't refer to VB IDE unfortunately....

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Bob LambersonSoftware EngineerCommented:
you could do something like change the color of the control to delete in it's click event, and record it's name in a form variable.

then when your user clicks on the menu_delete, that event could hide or delete whatever control in named in the form variable.

Bob
0
 
sk33v3Commented:
Try this
www.grbackup.com/ee/dynamic_controls/Remove_controls.zip

please note the on error resume next. That is placed there because if you remove a control and then try to set a property of that control it will generate an error. Also note that you can not remove the label(0) because that was created at design time. you may only destroy object that you create during runtime.
0
 
sk33v3Commented:
Can I ask why this only rated a B?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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