Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
AnswerRe: Processor ID in C# vs C++ Pin
Luc Pattyn20-Apr-07 3:21
sitebuilderLuc Pattyn20-Apr-07 3:21 
AnswerRe: Processor ID in C# vs C++ Pin
Dave Kreskowiak20-Apr-07 4:42
mveDave Kreskowiak20-Apr-07 4:42 
GeneralRe: Processor ID in C# vs C++ Pin
Stevo Z20-Apr-07 4:50
Stevo Z20-Apr-07 4:50 
GeneralRe: Processor ID in C# vs C++ Pin
Dave Kreskowiak20-Apr-07 5:01
mveDave Kreskowiak20-Apr-07 5:01 
GeneralRe: Processor ID in C# vs C++ Pin
Luc Pattyn20-Apr-07 12:03
sitebuilderLuc Pattyn20-Apr-07 12:03 
GeneralRe: Processor ID in C# vs C++ Pin
Dave Kreskowiak20-Apr-07 13:18
mveDave Kreskowiak20-Apr-07 13:18 
QuestionTable of content in c# [modified] Pin
sulabh202019-Apr-07 23:36
sulabh202019-Apr-07 23:36 
QuestionDataBinding of enum property from COM library Pin
El'Cachubrey19-Apr-07 23:27
El'Cachubrey19-Apr-07 23:27 
Hi all
I have problem, what seems like a bug in C#

I need to bind an property of COM object with enum type to ComboBox.

examp:
<br />
   <br />
        public class CBItem<br />
        {<br />
            public CBItem(ComLib.TypeEnum Type, string Name)<br />
            {<br />
                _type = Type;<br />
                _name = Name;<br />
            }<br />
<br />
            ComLib.TypeEnum _type;<br />
            string _name;<br />
<br />
<br />
            public ComLib.TypeEnum Type { get { return _type; } }<br />
<br />
            public string Name { get { return _name; } }<br />
        }<br />
<br />
...............................<br />
<br />
           this.comboBox1.DataSource = new List<CBItem>(new CBItem[] {<br />
                new CBItem(ComLib.TypeEnum.enOne, "One"), <br />
                new CBItem(ComLib.TypeEnum.enTwo, "Two")<br />
           });<br />
<br />
           this.comboBox1.DisplayedMember = "Name";<br />
           this.comboBox1.ValueMember = "Type";<br />
<br />
           /*<br />
               myComObject is com object <br />
               have properties:<br />
             <br />
               ComLib.TypeEnum Type<br />
               string Name <br />
           */<br />
            //Now bind this property to SelectedValue of comboBox]<br />
            this.comboBox1.DataBindings.Add("SelectedValue", myComObject , "Type");<br />
            //Get exception [Can't bind Type property!!!!!]<br />
            //But if i bind another property alll work fine<br />
            this.comboBox1.DataBindings.Add("SelectedValue", myComObject , "Name");<br />
<br />
<br />


I have a way to avoid this problem by wrapping of COM object like this:

<br />
  <br />
  public class ComWrap<br />
  {<br />
     public ComWrap(ComLib.ComObj ComObj)<br />
     {<br />
         _comObj = ComObj;<br />
     }<br />
<br />
     public ComLib.TypeEnum Type { get {return comObj.Type }}<br />
     <br />
     ComObj _comObj;<br />
<br />
  }<br />
<br />
................<br />
<br />
//This work fine<br />
ComWrap cw = new ComWrap(myComObject);<br />
this.comboBox1.DataBindings.Add("SelectedValue", cw, "Type");<br />
<br />
<br />
<br />


There is more elegant way to awoid this pertrub (with out using of auxiliar wrapper)?
and may be someone can point out why this occur.

THANK
QuestionRobotics in C# HeLP with programming Pin
faysie19-Apr-07 22:47
faysie19-Apr-07 22:47 
AnswerRe: Robotics in C# HeLP with programming Pin
Christian Graus19-Apr-07 23:02
protectorChristian Graus19-Apr-07 23:02 
GeneralRe: Robotics in C# HeLP with programming Pin
faysie19-Apr-07 23:10
faysie19-Apr-07 23:10 
GeneralRe: Robotics in C# HeLP with programming Pin
Christian Graus19-Apr-07 23:30
protectorChristian Graus19-Apr-07 23:30 
GeneralRe: Robotics in C# HeLP with programming Pin
faysie19-Apr-07 23:43
faysie19-Apr-07 23:43 
GeneralRe: Robotics in C# HeLP with programming Pin
Christian Graus19-Apr-07 23:50
protectorChristian Graus19-Apr-07 23:50 
GeneralRe: Robotics in C# HeLP with programming Pin
faysie19-Apr-07 23:54
faysie19-Apr-07 23:54 
GeneralRe: Robotics in C# HeLP with programming Pin
Christian Graus20-Apr-07 1:44
protectorChristian Graus20-Apr-07 1:44 
GeneralRe: Robotics in C# HeLP with programming Pin
faysie20-Apr-07 4:35
faysie20-Apr-07 4:35 
AnswerRe: Robotics in C# HeLP with programming Pin
Russell Jones20-Apr-07 2:40
Russell Jones20-Apr-07 2:40 
GeneralRe: Robotics in C# HeLP with programming Pin
faysie23-Apr-07 4:49
faysie23-Apr-07 4:49 
GeneralRe: Robotics in C# HeLP with programming Pin
Russell Jones23-Apr-07 4:57
Russell Jones23-Apr-07 4:57 
QuestionMyNamespace in C# Pin
manustone19-Apr-07 22:38
manustone19-Apr-07 22:38 
AnswerRe: MyNamespace in C# Pin
Christian Graus19-Apr-07 22:59
protectorChristian Graus19-Apr-07 22:59 
GeneralRe: MyNamespace in C# Pin
Brady Kelly20-Apr-07 0:15
Brady Kelly20-Apr-07 0:15 
AnswerRe: MyNamespace in C# Pin
Guffa20-Apr-07 2:38
Guffa20-Apr-07 2:38 
GeneralRe: MyNamespace in C# Pin
Brady Kelly20-Apr-07 2:45
Brady Kelly20-Apr-07 2:45 

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.