Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: Newbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 1:16
aberbotimue28-Apr-08 1:16 
GeneralRe: Newbie - Unable to cast object of type... Pin
Anthony Mushrow28-Apr-08 2:12
professionalAnthony Mushrow28-Apr-08 2:12 
GeneralRe: Newbie - Unable to cast object of type... Pin
J4amieC28-Apr-08 0:54
J4amieC28-Apr-08 0:54 
GeneralRe: Newbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 1:14
aberbotimue28-Apr-08 1:14 
Generalcopying a large file using streaming Pin
248912828-Apr-08 0:38
248912828-Apr-08 0:38 
GeneralRe: copying a large file using streaming Pin
Anthony Mushrow28-Apr-08 1:00
professionalAnthony Mushrow28-Apr-08 1:00 
General[MULTI-POST :: IGNORE IT] Re: copying a large file using streaming Pin
Vasudevan Deepak Kumar28-Apr-08 1:38
Vasudevan Deepak Kumar28-Apr-08 1:38 
GeneralBinding DataGridViewComboBoxColumn to Enumeration Pin
Bekjong28-Apr-08 0:33
Bekjong28-Apr-08 0:33 
Hi,

I have a datagrid view bound to a List of objects implementing INotifyPropertyChanged. One of the object's properties is an enumeration, which I want to bind to a DataGridViewComboBoxColumn so that the user can change it's value.

The problem is that if I bind it to the enumeration property, it will only show the enumeration value it's initialized at. I've found many examples stating you should set the combobox's DataSource property to <code>Enum.GetValues(typeof(EnumerationType));</code> This shows all values in the combobox, but I don't see the point: It won't bind its values to my actual data source.

Example:

<pre>
public class Dinges : INotifyPropertyChanged
{
public enum tester
{
apple = 1, pear = 2, banana = 3
}

#region INotifyPropertyChanged Members

public event PropertyChangedEventHandler PropertyChanged;

#endregion

private tester enumerationtest = tester.apple;

public tester MyProperty
{
get { return enumerationtest; }
set
{
enumerationtest = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("MyProperty"));
}
}
}

public class DingesList : List<Dinges>
{
public DingesList()
{
this.Add(new Dinges());
}
}


public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

DingesList d = new DingesList();
dingesListBindingSource.DataSource = d;
dataGridView1.DataSource = dingesListBindingSource;

// this results in the combobox in my datagrid showing "apple" as a value and no other options to choose from

// option 2 displays all possible values, but isn't bound to the actual object
comboColumn.DataSource = Enum.GetValues(typeof(WindowsApplication1.Dinges.tester));
}

}
</pre>


Any help is greatly appreciated.


Standards are great! Everybody should have one!

GeneralProblem in publishing an client server application... Pin
Vicky2Galaxy28-Apr-08 0:21
Vicky2Galaxy28-Apr-08 0:21 
GeneralUnable to Capture Incoming Mail Event in Outlook Pin
narayanagvs28-Apr-08 0:09
narayanagvs28-Apr-08 0:09 
GeneralRe: Unable to Capture Incoming Mail Event in Outlook Pin
Bert delaVega29-Apr-08 5:39
Bert delaVega29-Apr-08 5:39 
QuestionCannot pass String Arrays as arguments to delegates?? Pin
ptr2void27-Apr-08 23:37
ptr2void27-Apr-08 23:37 
AnswerRe: Cannot pass String Arrays as arguments to delegates?? Pin
Vikram A Punathambekar27-Apr-08 23:44
Vikram A Punathambekar27-Apr-08 23:44 
GeneralRe: Cannot pass String Arrays as arguments to delegates?? Pin
Anthony Mushrow28-Apr-08 1:02
professionalAnthony Mushrow28-Apr-08 1:02 
GeneralRe: Cannot pass String Arrays as arguments to delegates?? Pin
ptr2void28-Apr-08 1:24
ptr2void28-Apr-08 1:24 
QuestionOpening a sub form Pin
M. J. Jaya Chitra27-Apr-08 22:49
M. J. Jaya Chitra27-Apr-08 22:49 
GeneralRe: Opening a sub form Pin
N a v a n e e t h27-Apr-08 23:08
N a v a n e e t h27-Apr-08 23:08 
GeneralRe: Opening a sub form Pin
Bert delaVega29-Apr-08 5:42
Bert delaVega29-Apr-08 5:42 
QuestionLogging by appending log entries to an XML file. Pin
Zerox MXI27-Apr-08 22:41
Zerox MXI27-Apr-08 22:41 
GeneralRe: Logging by appending log entries to an XML file. Pin
N a v a n e e t h27-Apr-08 22:58
N a v a n e e t h27-Apr-08 22:58 
GeneralRe: Logging by appending log entries to an XML file. Pin
Zerox MXI27-Apr-08 23:07
Zerox MXI27-Apr-08 23:07 
GeneralRe: Logging by appending log entries to an XML file. Pin
N a v a n e e t h27-Apr-08 23:49
N a v a n e e t h27-Apr-08 23:49 
GeneralRe: Logging by appending log entries to an XML file. Pin
Vikram A Punathambekar27-Apr-08 23:47
Vikram A Punathambekar27-Apr-08 23:47 
GeneralRe: Logging by appending log entries to an XML file. Pin
Not Active28-Apr-08 3:01
mentorNot Active28-Apr-08 3:01 
QuestionAccessing executable 'metadata' (summary information) Pin
I'm a member...27-Apr-08 22:30
I'm a member...27-Apr-08 22:30 

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.