Results 1 to 5 of 5

Thread: listview problem..

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    5

    Angry listview problem..

    hi guys..
    i have a problem again..regarding list view..
    well,i have to create a list view with 3 columns..
    the third item in the list view should b editable by user...
    so, i have set the labeledit to true..
    but, the listview stil canot b editable...
    so, wat should i do??
    hope to receive ur helps as soon as possible..thanks..

    regards,
    cherie

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    Miami FL
    Posts
    38
    I don't know if you want to do anything like this but:

    I have a listview in a program I am making and the way I let the user edit the rows is first they select a row, then click a button that opens up a dialog box and they can change the items/subitems. when the dialog box closes the program updates the items/subitems of the selected row.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    5

    thanks

    thanks...
    so,can us send me the coding ???
    i would like to try to modify it..
    thanks a lot..

  4. #4
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    I'm actually needing that code too. I can't wait for you to post it!!

  5. #5
    Member
    Join Date
    Mar 2004
    Location
    Miami FL
    Posts
    38
    OK, I'm going to paste the code directly from my project, so I guess all you might need to do is change the variable/object naming. the first line of code sees if there is an item selected (I have multiselect off btw). frmNewRecord is just a seperate form that I have some textboxes on and a button. I first create an instance of the form in memory and assign the text property of the textboxes the current labels (as you called them) of the selected item. then I call the showdialog method. the user then changes the text, and when the button is clicked, the program then retrieves the new values from the textboxes and puts them in the selected row of the listview. The only coding you need to do in the second form is in the button, put Me.Hide. The form will still be in memory, but if you use Me.Close, you won't be able to refer to the form since it will be dumped.

    VB Code:
    1. If lstCurrentSequence.SelectedIndices.Count > 0 Then
    2.             Dim frmNewRecord As New frmNewRecord()
    3.             frmNewRecord.txtSampleDescription.Text = lstCurrentSequence.SelectedItems(0).SubItems(1).Text
    4.             frmNewRecord.txtOperator.Text = lstCurrentSequence.SelectedItems(0).SubItems(2).Text
    5.             frmNewRecord.dtpDate.Value = Convert.ToDateTime(lstCurrentSequence.SelectedItems(0).SubItems(3).Text)
    6.             frmNewRecord.ShowDialog()
    7.             lstCurrentSequence.SelectedItems(0).SubItems(1).Text = frmNewRecord.txtSampleDescription.Text
    8.             lstCurrentSequence.SelectedItems(0).SubItems(2).Text = frmNewRecord.txtOperator.Text
    9.             lstCurrentSequence.SelectedItems(0).SubItems(3).Text = frmNewRecord.dtpDate.Value.ToShortDateString
    10. End If

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