Advertisement

07.15.2008 at 12:33PM PDT, ID: 23567322
[x]
Attachment Details

adding a combobox to a datagrid visual studio 2003, .net 1.1

Asked by mickygene in Visual Studio .NET 2003, Microsoft Visual C#.Net, Windows Forms for .Net

Tags: c#

I am trying to add a combobox to a datagrid in Visual Studio 2003.  (.Net 1.1). I found this script to create dropdown box which I will attach this question. It's called "combobox.txt". I have done nothing to that.   I pull data from a table and this one field is called "arrest_made". The values for this field are either "Yes" or "No". So, that's what I want the dropdown values to be.  Thus, if the value from the table is "No", I want it to show "No" from the dropdown box as well.  But, first things first. I need to get the combobox added in first.    Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
dg_suspect_information.DataSource = FIMSDBOperations.GetSuspects().Tables["tbl_suspects"].DefaultView;
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "tbl_suspects";
ts.RowHeadersVisible = false;
 
dg_suspect_information.TableStyles.Add(ts);
 
//This is the column I want to add a combobox too.
ts.GridColumnStyles["arrest_made"].MappingName="arrest_made";
ts.GridColumnStyles["arrest_made"].HeaderText="Arrest made";
ts.GridColumnStyles["arrest_made"].Width = 100;
 
//attempting to add combobox to field above. Doesn't work.
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
ComboTextCol.myComboBox.DisplayMember = "arrest_made";
ComboTextCol.myComboBox.ValueMember = "arrest_made";
ComboTextCol.myComboBox.Items.Add("No");
ComboTextCol.myComboBox.Items.Add("Yes");
ComboTextCol.myComboBox.Text = ts.GridColumnStyles["arrest_made"].ToString();
Attachments:
 
Code found from the web to create a combobox in C# visual studio 2003
 
[+][-]07.17.2008 at 09:12AM PDT, ID: 22027029

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 08:09PM PDT, ID: 22041209

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2003, Microsoft Visual C#.Net, Windows Forms for .Net
Tags: c#
Sign Up Now!
Solution Provided By: mickygene
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628