Solved

C# fill up combobox

Posted on 2014-04-30
2
948 Views
Last Modified: 2016-02-16
Hi Guys ,

I started a new project and I would like to work with the LINQ to ADO.NET Entity Data Model in order to query database from SQl server.

The application built base on widows form application and I would like to fill up some combobox with one of the column I have in the database.

Can somebody provide the code for this.

Also I need some code behind the data grid view to query couple of columns from different table.

Thanks ,
0
Comment
Question by:Moti Mashiah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 500 total points
ID: 40033921
you can populate combobox like below. cmb1 is combobox object.

var db = new MyDataClass1DataContext();
cmb1.DisplayMember = "MY_TITLE";
cmb1.ValueMember = "MY_ID";
cmb1.DataSource = (from c in db.MY_MASTERs
                        select new { c.MY_ID, c.MY_TITLE }).ToList();

Open in new window

0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
ID: 40034588
Thank you very much I will open another thread for the second question " how to fill up grid from multiple tables.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question