问题描述
好了,我有一个窗体上的列表视图,当一个按钮为pressed它开辟了一种新的形式与所选ListView项的内容,它是在一系列文本框的子项。然后,用户可以更改数据的文本框,要么preSS保存进行更改或取消关闭该窗口。
什么命令我会用改变所选ListView项和子项来无论是在箱子?
Ok, so I have a listview on one form, and when a button is pressed it opens up a new form with the contents of the selected listview item and it's subitems in a series of textboxes. The user can then change the data in the textboxes and either press save to make the changes or cancel to close the window.What command would I use to change the selected listview item and subitems to whatever is in the boxes?
这是code用于填充盒:
this is the code that populates the boxes:
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim appeditcontents As String = main.passlist.SelectedItems(0).ToString
Dim appstrlen As Integer = appeditcontents.Length()
Dim apptotal As Integer = appstrlen - 16
Dim usereditcontents As String = main.passlist.SelectedItems(0).SubItems(1).ToString
Dim userstrlen As Integer = usereditcontents.Length()
Dim usertotal As Integer = userstrlen - 19
Dim passeditcontents As String = main.passlist.SelectedItems(0).SubItems(2).ToString
Dim passstrlen As Integer = passeditcontents.Length()
Dim passtotal As Integer = passstrlen - 19
appedit.Enabled = False
appedit.Text = main.passlist.SelectedItems(0).ToString.Substring(15, apptotal)
useredit.Text = main.passlist.SelectedItems(0).SubItems(1).ToString.Substring(18, usertotal)
passedit.Text = main.passlist.SelectedItems(0).SubItems(2).ToString.Substring(18, passtotal)
End Sub
在清理这个code任何指针可能会帮助了。
Any pointers on cleaning up this code would probably help too.
推荐答案
此页面看起来它会帮助你。
这篇关于选定的ListView项的编辑项或子项的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!