CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2000
    Posts
    23

    How to add items to listboxs from textboxs?

    Hi All

    I was wondering if someone could help?

    How do you add a number of items to a listbox from textbox's. I have three textboxs: FirstName, LastName and Age. I want to add the data i type in these boxs to appear in the listbox when i click an add button which has three columns in it. The listbox is for viewing only and it will of course have many row's in it after awhile, and i want to be able to select a row and that data appear back in the textboxs so i can edit them.

    I also want to be able to delete a row when it's not needed anymore, i think this last one can be done by "removing.item" from what i have read so far. But the other bit is more difficult to find an example for.

    Can anyone help?
    Thanks.



  2. #2
    Join Date
    Jun 2000
    Location
    Nepal
    Posts
    108

    Re: How to add items to listboxs from textboxs?

    The list box is not for you. Use the MSFlexGrid control. You can add it from Project|Components


  3. #3
    Join Date
    Sep 2000
    Posts
    23

    Re: How to add items to listboxs from textboxs?

    Thanks CK, i've looked at the msflexgrid and come across a sample but from what i can make out, the number of rows is defined whereas the one i want will vary, one group may have 2 rows in it another might have 20 or more.
    Plus i wanted to select an item to appear back in the textbox's to make it neat and tidy to work with one item at a time, this might still work though with the msflexgrid. ( i suppose the flexgrid alows you to edit it directly, doe's it? )
    I'd still prefer the listview and textbox's as it looks better than the flexgrid.

    I could make use of this elsewhere though, thanks for that.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured