Solved

How to process a selection in a listbox, and set a selection in code

Posted on 2008-06-13
1
267 Views
Last Modified: 2010-04-23
I have listbox on a form in my VB 6.0 app.  I simply  need to be able to do two things:

 1) In my app, I keep track of what item is currently selected.  So, when the form is displayed, I need to highlight that item in the listbox.

2) Upon a list item selection, I need to immediately process the selection and update my dialog.

Thanks ahead of time.
0
Comment
Question by:clintonJ
1 Comment
 
LVL 11

Accepted Solution

by:
AkisC earned 500 total points
ID: 21784282
create a sub or function that will do the work you want and

dim item as integer=me.listbox.FindString ("xxxxx")
if item>-1 then
   listbox.SetSelected(item, True)
   //call the sub to do your work
end if

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Gridview selected row 9 49
Store results in vb.net 3 24
Get number of Files in Directory and Sub Directories 2 48
location of a form 2 24
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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