Click here to Skip to main content
16,017,954 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CoMicrosEditBox
{
    public class CoMicrosEditBox: System.Windows.Forms.TextBox
    {
        {
            private List<string> _ColumnHeading = new List<string>();

            public List<string> ColumnHeading
            {
                set { _ColumnHeading = value; }
                get { return _ColumnHeading; }
            }
        }
    }

While using this CoMicrosEditBox in another application, cannot add values for ColumnHeading. Saying System.String doesn't have contructor.
But if replace string with int, it is working fine.

[edit]'<' and '>' characters escaped to make the code fragment more meaningfull! - OriginalGriff[/edit]
Posted
Updated 27-Sep-10 6:07am
v7
Comments
Richard MacCutchan 26-Sep-10 9:23am    
Something missing from the above; where is the String that you replace with int?
E.F. Nijboer 26-Sep-10 9:34am    
You might also consider renaming your class or namespace because the same can work quite confusing (eg. CoMicrosEditBox.CoMicrosEditBox)
OriginalGriff 26-Sep-10 11:14am    
I replaced your < and > characters with the escaped versions &lt; and &gt;. If you don't then the HTML removes them together with any contents as it considers them HTML commands.
There are a set of options below the text box to use when pasting code fragments which can help with this.
OriginalGriff 26-Sep-10 11:16am    
Bloody HTML! In the comment above, then second pair of less and greater than characters shoule be read as:
ampersand lt semicolon (&amp; lt ;)
and
ampersand gt semicolon (&amp; gt ;)

I have just tried your code (corrected for that misplaced open brace), and it compiles and runs fine. Perhaps you could post the actual snippet that fails, including the error message.
 
Share this answer
 
Comments
Sandeep Mewara 26-Sep-10 13:13pm    
:) so basically he already have a resolved issue at hand!
Richard MacCutchan 26-Sep-10 15:07pm    
Dunno, Sandeep; all I'm saying is that the code posted above has no errors.
First add

using System.Collections;


and make your list as arraylist

Bcoz list is a generic
if you want to use generic please define the generic type "T"

___________________________________________________
Regards

Nakul Kundra
(Software Developer)
 
Share this answer
 
Comments
OriginalGriff 26-Sep-10 11:54am    
He did - that why I edited his post. Don't forget that HTML assumes the &lt; and &gt; are meant for it, and swallows them unless they are escaped. In this case, (as most) swapping from a List&lt;string&gt; to an ArrayList would be a step back in all sorts of ways...
Line 5 is:
using System.Windows.Forms;

There is no error in it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900