Click here to Skip to main content
15,889,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: RichTextBox throws tab in there Pin
likefood8-May-06 9:23
likefood8-May-06 9:23 
GeneralRe: RichTextBox throws tab in there Pin
likefood8-May-06 9:28
likefood8-May-06 9:28 
AnswerRe: RichTextBox throws tab in there Pin
likefood8-May-06 10:01
likefood8-May-06 10:01 
GeneralRe: RichTextBox throws tab in there Pin
Office Lineman8-May-06 12:32
Office Lineman8-May-06 12:32 
GeneralRe: RichTextBox throws tab in there Pin
likefood9-May-06 7:27
likefood9-May-06 7:27 
Questionspeech sdk5.1 Pin
TheEagle8-May-06 8:09
TheEagle8-May-06 8:09 
Question2 clicks to activate form menu Pin
Ravi Bhavnani8-May-06 8:09
professionalRavi Bhavnani8-May-06 8:09 
Questionwhy the DataGridViewComboBoxColumn values are lost?!!! Pin
Elvia Gonzalez8-May-06 7:56
Elvia Gonzalez8-May-06 7:56 
Hi everybody!

I have DataGridView whose sourse I set to a datatable with 4 columns
containing data. I then remove two columns, create a DataGridViewComboBoxColumn and DataGridViewCheckBoxColumn and insert this into the same location as the columns that were removed. I want to set as the selected value in the combo box of every cell in the DataGridView a specific value. I have done it, but once the debugger leaves the file with the code that executes this functionality, the values that were set in the combo box and check box are lost.

I don't know whether the problem is because I removed and then added these columns. At the end of the Load() method I have this line: dataGridView.AutoGenerateColumns = false; if I don't use it, the column that I removed appears again. Any idea about why the value of the DataGridComboBoxColumn is changed to null automatically and how to solve it?

Other thing is that if I change the values of the combo box in the datagridview and later I want to save them, when I get the values are not the ones I chose, but the values that I set at the beginning as the datasource of the datagridview.

This is part of the code I’m using:

private void FrmTestCases_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();

dt.Columns.Add(new DataColumn("Path", typeof(string)));
dt.Columns.Add(new DataColumn("Category", typeof(string)));
dt.Columns.Add(new DataColumn("Include", typeof(string)));
dt.Columns.Add(new DataColumn("Description", typeof(string)));

dataGridView.DataSource = dt;

dataGridView.Columns.Remove("Category");
dataGridView.Columns.Remove("Include");
DataGridViewComboBoxColumn cb = new DataGridViewComboBoxColumn();
DataGridViewCheckBoxColumn kb = new DataGridViewCheckBoxColumn();
cb = CreateComboBoxColumn("Category", "Category");
kb = CreateCheckBoxColumn("Include", "Include");

dataGridView.Columns.Insert(1, cb);
dataGridView.Columns.Insert(2, kb);
}

// ---------
private void OnFormClosing(object sender, FormClosingEventArgs e)
{
DataRowView testCase = (DataRowView)dataGridView.Rows[0].DataBoundItem;
String fileStream = testCase["Include"] + "," + testCase["Category"];
}

I've been working on it for days but NO LUCK !! Can you please give me a hand?!

Elvia

QuestionShow and hide buttons Pin
Zspada158-May-06 7:26
Zspada158-May-06 7:26 
AnswerRe: Show and hide buttons Pin
led mike8-May-06 7:52
led mike8-May-06 7:52 
AnswerRe: Show and hide buttons Pin
Stefan Troschuetz8-May-06 7:53
Stefan Troschuetz8-May-06 7:53 
QuestionAttach to Process, how to do in C#? Pin
kumar.bs8-May-06 7:24
kumar.bs8-May-06 7:24 
AnswerRe: Attach to Process, how to do in C#? Pin
Douglas Troy8-May-06 8:50
Douglas Troy8-May-06 8:50 
QuestionClear a WebBrowser's History???? Pin
FoxholeWilly8-May-06 7:22
FoxholeWilly8-May-06 7:22 
AnswerRe: Clear a WebBrowser's History???? Pin
led mike8-May-06 7:51
led mike8-May-06 7:51 
GeneralRe: Clear a WebBrowser's History???? Pin
FoxholeWilly9-May-06 3:57
FoxholeWilly9-May-06 3:57 
GeneralRe: Clear a WebBrowser's History???? Pin
led mike9-May-06 7:04
led mike9-May-06 7:04 
GeneralRe: Clear a WebBrowser's History???? Pin
FoxholeWilly10-May-06 3:55
FoxholeWilly10-May-06 3:55 
AnswerRe: Clear a WebBrowser's History???? Pin
kalyanhere8-May-06 19:07
kalyanhere8-May-06 19:07 
QuestionEmbedded javascript not working. Pin
Loophole8-May-06 6:48
Loophole8-May-06 6:48 
AnswerRe: Embedded javascript not working. Pin
Loophole8-May-06 8:24
Loophole8-May-06 8:24 
Questionmemory allocation Pin
torNAdE8-May-06 6:34
torNAdE8-May-06 6:34 
AnswerRe: memory allocation Pin
Judah Gabriel Himango8-May-06 6:40
sponsorJudah Gabriel Himango8-May-06 6:40 
GeneralRe: memory allocation Pin
torNAdE8-May-06 6:49
torNAdE8-May-06 6:49 
GeneralRe: memory allocation Pin
Judah Gabriel Himango8-May-06 7:06
sponsorJudah Gabriel Himango8-May-06 7:06 

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.