I have Listview in form1 having columns AccountID, AccountName and AccountType and Form2 Datagridview unbound columns are Date, DocNo AccountID, AccountName, Debit, Credit.
i need two things:
when i select any row in
listviewand double click, onlyAccountIDshould be transferred inAccountIDCells of DatagridView and consideringAccountIDas Lookup value, CorrespondingAccountNameshould also be displayed inAccountNameColumn ofDatgirdview.if i enter
AccountIDmanually in theAccountIDCell ofDataGridViewCorrespondingAccountNameshould also be displayed inAccountNameColumn ofDatgirdview
Please help me to solve this issue.
First of all, you didn't tag your post with language and framework and didn't mentioned it either. I'm posting VB.NET winform solution.
DoubleClickonListView1:DataGridView:If you wanted a C# solution, you can use some online converter.
Few comments, though:
DataTables.ComboBoxinstead ofListViewif possible, because it simplifies selection whenValueMemberandDisplayMemberare set and used. Alternatively, if you need to use multi-column visual output, I'd choose anotherDataGridView. When properly set, looks as simple asListView, without the odd data model behind.