Topic by Sophia Cai
I implement a Workspace add-in. In this add-in, I have a list view and a button. When I click on the button, I can retrieve and show a list of data in the list view.
Then, I want to select one row and pass the value to one field in current workspace.
How can I implement this?
public partial class ListViewControl : UserControl
{
public delegate void ShowListHandler(ListViewControl uc);
public event ShowListHandler ShowListClicked;
public ListViewControl()
{
InitializeComponent();
listView1.FullRowSelect = true;
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
ListView.SelectedListViewItemCollection items = this.listView1.SelectedItems;
String ContactId = "";
foreach(ListViewItem item in items)
{
ContactId = item.SubItems[0].Text;
}
//How to Pass ContactId to a field in current workspace?
}
private void buttonShowList_Click(object sender, EventArgs e)
{
if (ShowListClicked != null)
{
ShowListClicked(this);
}
}
}