Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
AnswerRe: Painting issue while running two different threads Pin
Dave Kreskowiak23-Jun-11 2:36
mveDave Kreskowiak23-Jun-11 2:36 
AnswerRe: Painting issue while running two different threads Pin
BobJanova23-Jun-11 4:44
BobJanova23-Jun-11 4:44 
QuestionTextBoxes, ListView, DataGrid or something else? Pin
TheBlindWatchmaker22-Jun-11 13:31
TheBlindWatchmaker22-Jun-11 13:31 
AnswerRe: TextBoxes, ListView, DataGrid or something else? Pin
Mycroft Holmes22-Jun-11 14:11
professionalMycroft Holmes22-Jun-11 14:11 
GeneralRe: TextBoxes, ListView, DataGrid or something else? Pin
TheBlindWatchmaker22-Jun-11 14:40
TheBlindWatchmaker22-Jun-11 14:40 
GeneralRe: TextBoxes, ListView, DataGrid or something else? Pin
Mycroft Holmes22-Jun-11 14:49
professionalMycroft Holmes22-Jun-11 14:49 
GeneralRe: TextBoxes, ListView, DataGrid or something else? Pin
Wayne Gaylard22-Jun-11 20:59
professionalWayne Gaylard22-Jun-11 20:59 
GeneralRe: TextBoxes, ListView, DataGrid or something else? Pin
TheBlindWatchmaker23-Jun-11 11:22
TheBlindWatchmaker23-Jun-11 11:22 
Thanks Mycroft, Wayne and Bob for your very helpful replies.

So, I have this now:


<code>// In Form1.Designer.cs
private System.Windows.Forms.DataGridView dgv_static_keys;
</code>


<code>// In Form1.cs
Dictionary&lt;string, string&gt; dict_static_keys = new Dictionary&lt;string, string&gt;
{
{"Key1", "Value1"},
{"Key2", "Value2"},
{"Key3", "Value3"},
};

BindingSource bindingsource = new BindingSource();
bindingsource .DataSource = dict_static_keys;
dgv_static_keys.DataSource = bindingsource;</code>


If I were to now update the Dictionary with a new key, say

<code>
dict_static_keys.Add("Key4", "Value4");
</code>

How do I get the DataGridView to update?

I tried this
<code>dg_static_keys.DataSource = dict_static_keys.ToList();</code>
but is there a better solution?
GeneralRe: TextBoxes, ListView, DataGrid or something else? Pin
BobJanova23-Jun-11 22:45
BobJanova23-Jun-11 22:45 
AnswerRe: TextBoxes, ListView, DataGrid or something else? Pin
BobJanova23-Jun-11 1:07
BobJanova23-Jun-11 1:07 
QuestionGSM Modem Pin
marshall_donuts22-Jun-11 7:46
marshall_donuts22-Jun-11 7:46 
AnswerRe: GSM Modem Pin
jschell22-Jun-11 9:19
jschell22-Jun-11 9:19 
GeneralRe: GSM Modem Pin
marshall_donuts26-Jun-11 14:46
marshall_donuts26-Jun-11 14:46 
GeneralRe: GSM Modem Pin
Andy41129-Jun-11 2:45
Andy41129-Jun-11 2:45 
Questionitextsharp colums question Pin
cromster22-Jun-11 5:17
cromster22-Jun-11 5:17 
AnswerRe: itextsharp colums question Pin
cromster11-Jul-11 5:18
cromster11-Jul-11 5:18 
QuestionPassing one of struct (from array) to other method (in different files) Pin
Blubbo22-Jun-11 5:16
Blubbo22-Jun-11 5:16 
QuestionRe: Passing one of struct (from array) to other method (in different files) Pin
MicroVirus22-Jun-11 5:55
MicroVirus22-Jun-11 5:55 
AnswerRe: Passing one of struct (from array) to other method (in different files) Pin
Blubbo22-Jun-11 7:03
Blubbo22-Jun-11 7:03 
AnswerRe: Passing one of struct (from array) to other method (in different files) Pin
MicroVirus22-Jun-11 8:29
MicroVirus22-Jun-11 8:29 
AnswerRe: Passing one of struct (from array) to other method (in different files) Pin
David198722-Jun-11 6:26
David198722-Jun-11 6:26 
QuestionFile copy onto remote server of different domain with credentials. Pin
surender.m22-Jun-11 3:27
surender.m22-Jun-11 3:27 
AnswerRe: File copy onto remote server of different domain with credentials. Pin
Mario Majčica22-Jun-11 4:44
professionalMario Majčica22-Jun-11 4:44 
GeneralRe: File copy onto remote server of different domain with credentials. [modified] Pin
surender.m22-Jun-11 18:38
surender.m22-Jun-11 18:38 
QuestionNeed help with excel and com objects in c sharp Pin
turbosupramk322-Jun-11 3:08
turbosupramk322-Jun-11 3:08 

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.