var names = from s in dbc.Patient_Detail_Tables where s.Name.Contains(txtSearch.Text) select s;
listBox1.DataSource = names;
listBox1.DisplayMember = "Name";
listBox1.ValueMember = "RegitrationNo";
How to get the valuemember using Linq query?
How to get the valuemember using Linq query?
VulpesPosted Jul 17, 2012, 10:46 AM
string s = ""; // default value, say, if SelectedValue is null
if (listBox1.SelectedValue != null)
{
s = listBox1.SelectedValue.ToString();
}
Sachin KaliaPosted Jul 17, 2012, 8:41 AM
This is the code segment which can help you out somewhere :
C#
paddu vPosted Jul 17, 2012, 7:51 AM
VulpesPosted Jul 17, 2012, 6:56 AM
var names = (from s in dbc.Patient_Detail_Tables where s.Name.Contains(txtSearch.Text) select s).ToList();