|
-
Apr 14th, 2004, 03:22 AM
#1
Thread Starter
New Member
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
-
Apr 15th, 2004, 05:58 PM
#2
Member
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.
-
Apr 15th, 2004, 07:42 PM
#3
Thread Starter
New Member
thanks
thanks...
so,can us send me the coding ???
i would like to try to modify it..
thanks a lot..
-
Apr 15th, 2004, 08:07 PM
#4
Frenzied Member
I'm actually needing that code too. I can't wait for you to post it!!
-
Apr 15th, 2004, 11:17 PM
#5
Member
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:
If lstCurrentSequence.SelectedIndices.Count > 0 Then
Dim frmNewRecord As New frmNewRecord()
frmNewRecord.txtSampleDescription.Text = lstCurrentSequence.SelectedItems(0).SubItems(1).Text
frmNewRecord.txtOperator.Text = lstCurrentSequence.SelectedItems(0).SubItems(2).Text
frmNewRecord.dtpDate.Value = Convert.ToDateTime(lstCurrentSequence.SelectedItems(0).SubItems(3).Text)
frmNewRecord.ShowDialog()
lstCurrentSequence.SelectedItems(0).SubItems(1).Text = frmNewRecord.txtSampleDescription.Text
lstCurrentSequence.SelectedItems(0).SubItems(2).Text = frmNewRecord.txtOperator.Text
lstCurrentSequence.SelectedItems(0).SubItems(3).Text = frmNewRecord.dtpDate.Value.ToShortDateString
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|