Click here to Skip to main content
15,906,708 members
Home / Discussions / C#
   

C#

 
GeneralI need to restore my database in C# windows application. I am using sql yog enterprise as database... Pin
santhosh1985april14-Feb-10 23:37
santhosh1985april14-Feb-10 23:37 
GeneralI need to restore my database in C# windows application. I am using sql yog enterprise as database Pin
santhosh1985april14-Feb-10 23:37
santhosh1985april14-Feb-10 23:37 
QuestionDetail View in DatagridView in c# Pin
Zeeshan Ahmed Memon23-Jun-09 1:40
Zeeshan Ahmed Memon23-Jun-09 1:40 
QuestionImplementing Timer Functionality in Online Test Application Pin
jjinagavenkatesh23-Jun-09 1:38
jjinagavenkatesh23-Jun-09 1:38 
AnswerRe: Implementing Timer Functionality in Online Test Application Pin
Gary Stafford23-Jun-09 15:39
Gary Stafford23-Jun-09 15:39 
QuestionLabel issue in Vista Pin
musefan23-Jun-09 1:18
musefan23-Jun-09 1:18 
AnswerRe: Label issue in Vista Pin
Christian Graus23-Jun-09 1:24
protectorChristian Graus23-Jun-09 1:24 
GeneralRe: Label issue in Vista Pin
musefan23-Jun-09 1:30
musefan23-Jun-09 1:30 
QuestionWhat's the best collection Pin
CodingLover23-Jun-09 0:56
CodingLover23-Jun-09 0:56 
AnswerRe: What's the best collection Pin
Christian Graus23-Jun-09 1:01
protectorChristian Graus23-Jun-09 1:01 
AnswerRe: What's the best collection Pin
DaveyM6923-Jun-09 1:10
professionalDaveyM6923-Jun-09 1:10 
AnswerRe: What's the best collection Pin
kb-boxer23-Jun-09 1:53
kb-boxer23-Jun-09 1:53 
AnswerRe: What's the best collection Pin
Rob Philpott23-Jun-09 2:16
Rob Philpott23-Jun-09 2:16 
AnswerRe: What's the best collection Pin
Mirko198023-Jun-09 2:17
Mirko198023-Jun-09 2:17 
Question[Message Deleted] Pin
yams251023-Jun-09 0:36
yams251023-Jun-09 0:36 
AnswerRe: WPF.... GRID.... !! am lost Pin
Christian Graus23-Jun-09 0:57
protectorChristian Graus23-Jun-09 0:57 
AnswerRe: [Message Deleted] Pin
EliottA23-Jun-09 3:32
EliottA23-Jun-09 3:32 
QuestionWinRTP on .NET C# Platform for streaming Pin
ray_ronnaret23-Jun-09 0:09
ray_ronnaret23-Jun-09 0:09 
QuestionMS Chart - Problem to display the records in Range Column Chart Pin
Jegansinna23-Jun-09 0:01
Jegansinna23-Jun-09 0:01 
QuestionDatagridview [modified] Pin
mjelten22-Jun-09 23:55
mjelten22-Jun-09 23:55 
Hi!

I have ha promblem with adding items to a DataGridViewComboBoxCell. This is what I am doing.






private void SetUpforDataGridView()
{
dataGridViewSearched.ColumnCount = 5;
dataGridViewSearched.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy;
dataGridViewSearched.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
dataGridViewSearched.ColumnHeadersDefaultCellStyle.Font =
new Font(dataGridViewSearched.Font, FontStyle.Bold);

dataGridViewSearched.Name = "Users Searched";
dataGridViewSearched.AutoSizeRowsMode =
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
dataGridViewSearched.ColumnHeadersBorderStyle =
DataGridViewHeaderBorderStyle.Single;
dataGridViewSearched.CellBorderStyle = DataGridViewCellBorderStyle.Single;
dataGridViewSearched.GridColor = Color.Black;
dataGridViewSearched.RowHeadersVisible = false;
dataGridViewSearched.Dock = DockStyle.Fill;

DataGridViewComboBoxColumn dataGridViewcombobox = new DataGridViewComboBoxColumn();

dataGridViewSearched.Columns.Add(dataGridViewcombobox);


dataGridViewSearched.Columns[0].Name = "UserId";
dataGridViewSearched.Columns[1].Name = "Förnamn";
dataGridViewSearched.Columns[2].Name = "Efternamn";
dataGridViewSearched.Columns[3].Name = "Legitimation";
dataGridViewSearched.Columns[4].Name = "Yrkesroll";
dataGridViewSearched.Columns[5].Name = "Enheter";
dataGridViewSearched.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

dataGridViewSearched.Columns[0].Visible = false;
dataGridViewSearched.Columns[0].DefaultCellStyle.Font =
new Font(dataGridViewSearched.DefaultCellStyle.Font, FontStyle.Italic);

dataGridViewSearched.SelectionMode =
DataGridViewSelectionMode.FullRowSelect;
dataGridViewSearched.MultiSelect = false;
}


And the I am trying to set the table with an object it works fine with the text propertis but not with the DataGridViewComboBoxCell.





public void BindUserList(List<User> userList)
{
dataGridViewSearched.Rows.Clear();
object[] row = new object[5];


foreach (User p in userList)
{
row[0] = p.UserId;
row[1] = p.FirstName;
row[2] = p.LastName;
row[3] = p.MedicalProfession;
row[4] = p.ProfessionalRole;

dataGridViewSearched.Rows.Add(row);

foreach (var unit in p.UnitActivationPeriods)
{
((DataGridViewComboBoxCell)dataGridViewSearched.Rows[dataGridViewSearched.Rows.Count - 1].Cells[5]).Items.Add(unit.ToString());
}

dataGridViewSearched.Rows[dataGridViewSearched.Rows.Count - 1].Tag = p;

}
labelNumberOfUsers.Text = userList.Count.ToString();
dataGridViewSearched.Refresh();
}

Thanks, Mjelten

modified on Tuesday, June 23, 2009 6:51 AM

QuestionA better way Pin
Sevententh22-Jun-09 23:44
Sevententh22-Jun-09 23:44 
AnswerRe: A better way Pin
Christian Graus23-Jun-09 1:00
protectorChristian Graus23-Jun-09 1:00 
AnswerRe: A better way Pin
dan!sh 23-Jun-09 1:02
professional dan!sh 23-Jun-09 1:02 
AnswerRe: A better way Pin
kb-boxer23-Jun-09 2:04
kb-boxer23-Jun-09 2:04 
GeneralRe: A better way Pin
Sevententh23-Jun-09 3:57
Sevententh23-Jun-09 3:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.