Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Edit Listbox's data at run time

Posted on 1998-03-15
6
Medium Priority
?
484 Views
Last Modified: 2008-02-01
Can anybody tell me whether it is possible to edit listbox's data  at run time .
if yes, how? (my listbox is not bound to any datacontrol.)
0
Comment
Question by:lkw022798
6 Comments
 

Expert Comment

by:tapsbin
ID: 1459141
Supposing you have following elements in a list box control.

Tapasvi
Baku
Asit
Shreyas

Now, you can access these elements as

   lstItem.List(0) for the first element   - Tapasvi
   lstItem.List(1) for the second element  - Baku
   lstItem.List(2) for the third element   - Asit

where lstItem is a name of list box control.
At the time of running your application you reassign the value
to your current index value item...

   lstItem.List(lstItem.NewIndex) = "Your Data Value"

I think these should solve your problem.

For further clarification please let me know...

Thanks,

TAPS

0
 

Author Comment

by:lkw022798
ID: 1459142
taps,pardon me, but i still do not see whether i can edit those data at run time . right now, when i run the application, i can select the items but not manaully change the contents.
if i m not wrong , you are giving the user the ability to key in new data right?
0
 

Expert Comment

by:tapsbin
ID: 1459143
yes, that's true. What i mean is...

allow to enter the user in a text box control...and reassign the
value to the selected element of a listbox control...

Thanks,

TAPS

0
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.

 

Author Comment

by:lkw022798
ID: 1459144
taps, i dont understand what you are talking about.
can i set certain property to make my listbox editable at runtime?
0
 

Expert Comment

by:Slasher
ID: 1459145
ikw,
        A listbox is not editable at anytime (you cannot key in data into it)
        What you might want to do is to have a text box which accepts the data
        and adds it into a listbox like what tapsbin has mentioned. If that is not
        appropriate, you can also use a multi-line text box (which looks like a listbox)
        You may set the (text1.locked) property to FALSE to prevent the user from
        editing the contents and set it to TRUE for editing purposes.
0
 

Accepted Solution

by:
mattyboy earned 40 total points
ID: 1459146
Try this:

Add an invisible TextBox to your form.  Set its appearance to Flat and it border to None.  Then, when you want to edit an item in a list box, determine the position of the selected item.  You can do this using some simple API calls.  Once you have determined the size and position of the selected item, set your invisible text box to the same size and position, change its text property to the value of the list item, and make it visible.  Then, on the change event of the TextBox, set the corresponding list item's value equal to the value of the TextBox.  Then, when you are done editing (perhaps by pressing Enter), set the TextBox's visible property back to false.

Let me know if you need help with the APIs

mattyboy
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month20 days, 18 hours left to enroll

810 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