TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
chetan Allipur
NA
541
167.5k
How to Convert datagrid column to combo Box in win forms c#
Jun 27 2018 11:51 PM
How to Convert datagrid column to combo Box in win forms c#.
I want second column as a Combobox.If I select the row it should select the combobox column also.
My Code:
Microsoft.Office.Interop.Word.Application app = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Word.Document doc1 = app.ActiveDocument;
Microsoft.Office.Interop.Word.Selection wordSelection = app.ActiveWindow.Selection;
dataGridView1.ColumnCount = 1;
dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView1.Columns[0].ReadOnly = true;
foreach (Microsoft.Office.Interop.Word.Style styles in doc1.Styles)
{
if (styles.BuiltIn == true)
{
GetWordStyles.Add(styles.NameLocal);
}
else
{
GetCustomStyles.Add(styles.NameLocal);
}
}
dataGridView1.Columns[0].Name = "Word Styles";
foreach (string wordstyles in GetWordStyles)
{
dataGridView1.Rows.Add(wordstyles);
}
DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
cmb.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
cmb.HeaderText = "ARID Styles";
cmb.Name = "cmbaridstyles";
//cmb.MaxDropDownItems = GetWordStyles.Count;
cmb.Items.Clear();
foreach (string aridstyles in GetCustomStyles)
{
cmb.Items.Add(aridstyles);
}
dataGridView1.Columns.Add(cmb);
ComboBox is added as seperate but I want comboBox as a column.
Reply
Answers (
1
)
How to add combo Box in ListViewItem in win forms c#.
Split Container selected Panel