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 Query
- 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
More Query from same tag
- Access one column from a list to use in another query
- Getting property value based on its column attribute value
- restrict num of items loaded in navigation property
- linq grouping by custom class
- How to do left joins in LINQ on multiple fields in single join
- Entity Framework NoTracking not working
- Return object that has value inside List property
- Splitting a list of items evenly between x number of smaller lists
- Errors in using LINQ with IList
- how can i correct wpf datagrid column name redundancy in visual studio 2012
- Fetch all foreign key records from collection
- Obtain all middle elements IEnumerable LINQ
- LINQ - Remove Parts of Expression Tree
- Group method not recognized in LINQ query
- Filtering Nodes and Join with other element to get caption
- Take next don't skip previous LINQ c#
- Boxing/unboxing in DataTables and LINQ
- How Can i retrieve date from a hashset that contains date and name using linq or contains?
- Iterating result of Linq query
- count records in datasource - c#
- How to select each element of a group and convert all of them into a single row?
- Linq ToDictionary Not Defined?
- Dynamically Adding a GroupBy to a Lambda Expression
- ASP NET MVC VB if searchstring is empty do or else LINQ
- c# linq to xml to list
- LINQ to filter included entity
- Handling DataTable Column Name Mismatch Exception
- Retrieving data LINQ vs Reflection
- Why do I have to call the Cast<> extension method on a DataGridViewRow?
- cosmos db LINQ query in documentation