deleting a item from a list box along with the ajoining address

how do I delete an item(name) from a list box while at the same time removing the address from a lable
m97smcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

caraf_gCommented:
This question is too vague. What do you mean exactly. How is the name in the list box linked to the text in the label?

Having said all that, there only is one way of doing it. To remove an item from a list box you must use the .RemoveItem method, and to empty a label you must set its caption to ""

I get the impression I'm missing something here. Can you explain yourself further?
0
m97smcAuthor Commented:
i have a list box for names and a lable for addresses of those names.

When i run my program and highlight a name the corosponding address appears.

I have a delete function. However, when i wish to delete a name from the list box i can not delete the address at the same time.

I realise that there is something wrong with my code but i dont know how to fix it

please help thank you
0
woottondCommented:
Try using the change method - if the change method of the list box is invoked then your labels should be refreshed... should be as simple as copying the part out of your list box where it sets the labels to be equal to the address - and putting that into the change method of the list box. You delete an item - the list box refreshes, and resets the labels to be either null or the current value... something like

dim textString as String
label1.caption = textString

Cheers,
.././david
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

tirupur_selvaCommented:
If there is something wrong in your code, put your piece of code here.
0
m97smcAuthor Commented:
Here is my code
Should I have loop function as well.
If yes how is this done when deleting.
Thank you very much


Private Sub mnuDelete_Click()
Dim TextString As String
If MsgBox("Do you wish to delete this record?",vbYesNo) = vbYes Then
lstName.RemoveItem (lstNames.ListIndex)
lblAddress.Caption = textString
End If
0
woottondCommented:
A loop? To allow multiple deletes? Sure if you want to (I don't think I really understand what you mean by the loop - guess that comes with the territory)

ok - I see - you pasted my sample code in - cool - could you post your insert code? Then I could see how you initially set your label to a value - essentially thats all you have to do... reinitiallize the label to be the current value be it null or an address.
.././david
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.