问题描述
我为数据选择创建了通用的列表视图选择形式
示例
从accname文本框打开时,然后显示帐户列表
选择时填写accname文本框
从项目文本框打开时,然后显示项目列表
选择时填写itemname文本框
还有更多的税箱,例如taxtype,broker,godown等
我的问题是如何通过数据将数据发送到
其调用文本框
如果从accname文本框中打开,则如果选择了数据,则将其填充到accname文本框中.
i am maked a common listview selection form for data seletion
expample
when its opend from accname textbox then show accounts list
on selection fill accname textbox
when its opend from item textbox then show itemlist
on selection fill itemname textbox
any many more taxboxes like taxtype,broker,godown etc
what my problem is how to send data form it to
its calling textbox
if opend from accname textbox then if dataselected fill it to accname text box
推荐答案
Private Sub lvwTaxList_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwTaxList.DoubleClick
'Brings up your 2nd Form
Form2.Show()
'Sends the data from each column in Selected row to appropriate text boxes on 2nd Form
' "lvwTaxList" would be your Listview
' "Item(lvwTaxList.FocusedItem.Index)" is the Selected row
' "SubItems(#)" are the columns {zero-based}
Form2.txtTaxType.text = lvwTaxList.Item(lvwTaxList.FocusedItem.Index).SubItems(0).Text
Form2.txtBroker.text = lvwTaxList.Item(lvwTaxList.FocusedItem.Index).SubItems(1).Text
Form2.txtGoDown.text = lvwTaxList.Item(lvwTaxList.FocusedItem.Index).SubItems(2).Text
End Sub
只需输入您自己的表格和控件名称在正确的位置,并且上面的代码应该适合您.如果您希望将第二张表格中的更改发送回第一张表格,则可以在第二张表格的编码中使用相反的方法:
Just put your own Form & Control names in the right places and the above code should work for you. If you want changes from your 2nd Form to be sent back to your 1st Form you would use the reverse method in the coding for your 2nd Form:
Form1.lvwTaxList.Item(lvwTaxList.FocusedItem.Index).SubItems(0).Text = txtTaxType.text
希望这会有所帮助!
给您和您的和平,
Matthew"Dra" Gon"Stohler
Hope this helps!
Peace to you and yours,
Matthew "Dra''Gon" Stohler
这篇关于如何从通用格式发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!