score:3
Something like this?
var query = (from c in dt.AsEnumerable()
select new { Value=c.Field<int>("RollNo"),
Text=c.Field<string>("Name")}).ToList();
And then just bind query
to the ListBox.
UPDATE
OP wants just strings; so this should do it:
var query = (from c in dt.AsEnumerable()
select "RollNo: "+ c.Field<int>("RollNo")+ " , Name: "+ c.Field<string>("Name")).ToList();
Source: stackoverflow.com
Related Articles
- Extract DataTable values using Linq "C#"
- Using LINQ to Extract Specific Values from Multi-Dimensional Array
- Change values of datatable column conditionally using Linq
- Separating the column values of DataTable using LINQ
- I need to compare list with Datatable and filter values using Linq
- Retrieve distinct values from datatable using linq vb.net
- How to sum values for multiple columns in DataTable using Groupby with Linq
- How to query a Datatable using LINQ and add values to a List?
- order datatable by relevance using linq by column values which are comma sperated
- Excluding NULL values in a datatable query using Linq
- filtering out null values while converting datatable to dictionary using linq
- calculating the occurrence of two column values in DataTable using linq
- Compare input double with datatable string column values within a range using between query(SQL query to Linq on datatable c# )
- calculating the occurrence of each column values in DataTable using linq
- replacing column values in a datatable and getting value in datatable datatype using linq
- c# Linq or code to extract groups from a single list of source data
- How to find out the repeated column values from a single datatable based on condition using LINQ
- Return Rows with Unique and Duplicate values from dataTable using LINQ
- c# - How to get specific values out of a DataTable using LINQ
- How to extract particular columns values from multiple rows using linq
- getting values of DataTable column and putting it into new datatable C# using LINQ
- Convert string[] to int[] in one line of code using LINQ
- How to select values within a provided index range from a List using LINQ
- Select All distinct values in a column using LINQ
- How to select multiple values from a Dictionary using Linq as simple as possible
- Get indexes of all matching values from list using Linq
- Convert dictionary values to list using linq
- Select distinct values from a list using LINQ in C#
- Using Linq to do a Contains with multiple values
- Getting a collection of index values using a LINQ query
- How do I decipher the Select method docs on MSDN?
- VB.NET linq extension methods such as ToList not working with generics
- Select multiple child columns with the same filter
- How to remove duplicates from a List<List<T>> for value types T?
- How to extract every occurence of tags in an XML file
- Linq expression to return the first overloaded method that takes 1 string parameter
- Distinct in linq?
- Linq to Sql Search through Tags
- Can a LINQ extension method create a new KeyValuePair with a new() .Value when a Where clause isn't satisfied
- How can I take a list of dates, and remove any that are within 1 minute of another date in the list with LINQ?
- Get properties from dynamic object using startswith
- Linq Slowness on Single Call
- Select multiple columns in LINQ
- Avoid Repeating Oneself When Doing A Select From IEnumerable
- Why Linq Query Return Duplicate column record
- Create object from element name and value of xml
- How I can Optimize this linq query
- How do I nest a call to a method within a call to a method using Expression.Call
- .net MVC, SelectLists, and LINQ
- Casting a list of objects to another one