Click here to Skip to main content
16,005,038 members
Home / Discussions / C#
   

C#

 
Questionwhat means Error: "No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type." Pin
shinelo200222-May-07 0:43
shinelo200222-May-07 0:43 
AnswerRe: what means Error: "No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type." Pin
Guffa22-May-07 0:46
Guffa22-May-07 0:46 
GeneralRe: what means Error: "No mapping exists from object type System.Windows.Forms.TextBox to a known managed provider native type." Pin
Member 814227811-Feb-12 4:52
Member 814227811-Feb-12 4:52 
QuestionSortable CollectionBase ? Pin
Gavin Roberts22-May-07 0:36
Gavin Roberts22-May-07 0:36 
AnswerRe: Sortable CollectionBase ? Pin
Pete O'Hanlon22-May-07 1:02
mvePete O'Hanlon22-May-07 1:02 
GeneralRe: Sortable CollectionBase ? Pin
Gavin Roberts22-May-07 1:59
Gavin Roberts22-May-07 1:59 
GeneralRe: Sortable CollectionBase ? Pin
Pete O'Hanlon22-May-07 4:01
mvePete O'Hanlon22-May-07 4:01 
GeneralRe: Sortable CollectionBase ? [modified] Pin
Gavin Roberts22-May-07 22:33
Gavin Roberts22-May-07 22:33 
Hi there,

Thanks for the sample code. I've gone to use it this morning and hit another problem.

I've created this:

<br />
    public interface RequestCollectionInterface<br />
    {<br />
        ImageList Images { get; set; }<br />
        int OpenCount { get; }<br />
        int PendingCount { get; }<br />
        int ImmediateCount { get; }<br />
        int HighCount { get; }<br />
    }<br />
    public class RequestCollection<T> : List<T>, IEnumerable<T> where T : RequestCollectionInterface<br />
    {<br />
        IEnumerator<T> IEnumerable<T>.GetEnumerator()<br />
        {<br />
            for (int i = 0; i < this.Count; i++)<br />
            {<br />
                yield return this[i];<br />
            }<br />
        }<br />
        IEnumerator IEnumerable.GetEnumerator()<br />
        {<br />
            throw new Exception("The method or operation is not implemented.");<br />
        }<br />
        public int OpenCount<br />
        {<br />
            get<br />
            {<br />
                int ReturnValue = 0;<br />
                foreach (Request item in this)<br />
                {<br />
                    if (item.Status == RequestStatus.Open)<br />
                        ReturnValue++;<br />
                }<br />
                return ReturnValue;<br />
            }<br />
        }<br />
        public int PendingCount<br />
        {<br />
            get<br />
            {<br />
                int ReturnValue = 0;<br />
                foreach (Request item in this)<br />
                {<br />
                    if (item.Status == RequestStatus.Pending)<br />
                        ReturnValue++;<br />
                }<br />
                return ReturnValue;<br />
            }<br />
        }<br />
        public int ImmediateCount<br />
        {<br />
            get<br />
            {<br />
                int ReturnValue = 0;<br />
                foreach (Request item in this)<br />
                {<br />
                    if (item.Priority = RequestPriority.Immediate)<br />
                        ReturnValue++;<br />
                }<br />
                return ReturnValue;<br />
            }<br />
        }<br />
        public int HighCount<br />
        {<br />
            get<br />
            {<br />
                int ReturnValue = 0;<br />
                foreach (Request item in this)<br />
                {<br />
                    if (item.Priority = RequestPriority.High)<br />
                        ReturnValue++;<br />
                }<br />
                return ReturnValue;<br />
            }<br />
        }<br />
    }<br />


And tried using it like this:

<br />
<br />
        private RequestCollection<Request> __GetRequests()<br />
        {<br />
            RequestCollection<Request> rc = new RequestCollection<Request>();<br />
            Request r = new Request();<br />
            r.Id = 1;<br />
            r.Summary = "This is a test";<br />
            r.To = "Test";<br />
            r.From = new User();<br />
            r.Priority = RequestPriority.Normal;<br />
            r.Status = RequestStatus.Open;<br />
            r.Created = DateTime.Now;<br />
            r.Assigned = r.Created;<br />
            r.Parent = rc;<br />
            r.Hours = r.Created.Subtract(r.Assigned).Hours;<br />
<br />
            rc.Add(r);<br />
            return rc;<br />
        }<br />


but I get the following error:

<br />
Error	3	The type 'HelpDesk.Request' must be convertible to 'HelpDesk.RequestCollectionInterface' in order to use it as parameter 'T' in the generic type or method 'HelpDesk.RequestCollection<T>'	C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\HelpDesk\HelpDesk\DataAccess.cs	66	44	HelpDesk<br />


this is my Request code:

<br />
    class Request<br />
    {<br />
        private int _Id;<br />
        private string _Summary;<br />
        private User _From;<br />
        private string _To;<br />
        private RequestPriority _Priority;<br />
        private RequestStatus _Status;<br />
        private DateTime _Created;<br />
        private DateTime _Assigned;<br />
        private DateTime _LastChanged;<br />
        private double _Hours;<br />
        private RequestCollection<Request> _Parent;<br />
<br />
        public int Id<br />
        {<br />
            get { return _Id; }<br />
            set { _Id = value; }<br />
        }<br />
        public string Summary<br />
        {<br />
            get { return _Summary; }<br />
            set { _Summary = value; }<br />
        }<br />
        public User From<br />
        {<br />
            get { return _From; }<br />
            set { _From = value; }<br />
        }<br />
        public string To<br />
        {<br />
            get { return _To; }<br />
            set { _To = value; }<br />
        }<br />
        public RequestPriority Priority<br />
        {<br />
            get { return _Priority; }<br />
            set { _Priority = value; }<br />
        }<br />
        public RequestStatus Status<br />
        {<br />
            get { return _Status; }<br />
            set { _Status = value; }<br />
        }<br />
        public DateTime Created<br />
        {<br />
            get { return _Created; }<br />
            set { _Created = value; }<br />
        }<br />
        public DateTime Assigned<br />
        {<br />
            get { return _Assigned; }<br />
            set { _Assigned = value; }<br />
        }<br />
        public DateTime LastChanged<br />
        {<br />
            get { return _LastChanged; }<br />
            set { _LastChanged = value; }<br />
        }<br />
        public double Hours<br />
        {<br />
            get { return _Hours; }<br />
            set { _Hours = value; }<br />
        }<br />
        public RequestCollection<Request> Parent<br />
        {<br />
            get { return _Parent; }<br />
            set { _Parent = value; }<br />
        }<br />
        public Image PriorityImage<br />
        {<br />
            get<br />
            {<br />
                Image ReturnValue = null;<br />
                try<br />
                {<br />
                    if (this.Parent != null && this.Parent.Images != null)<br />
                        ReturnValue = this.Parent.Images.Images[(int)this.Priority];<br />
                }<br />
                catch (Exception ex)<br />
                {<br />
                    int i = 99;<br />
                }<br />
                return ReturnValue;<br />
            }<br />
        }<br />
    }<br />

GeneralRe: Sortable CollectionBase ? Pin
Pete O'Hanlon23-May-07 8:47
mvePete O'Hanlon23-May-07 8:47 
AnswerRe: Sortable CollectionBase ? Pin
Martin#22-May-07 1:29
Martin#22-May-07 1:29 
QuestionI want some source code for converting a 3GPP file to JPEG or GIF file Pin
Luna-Bangalore22-May-07 0:09
Luna-Bangalore22-May-07 0:09 
QuestionChanging print page settings Pin
Gareth H21-May-07 23:55
Gareth H21-May-07 23:55 
AnswerRe: Changing print page settings Pin
Gareth H22-May-07 21:28
Gareth H22-May-07 21:28 
QuestionNew line character in XML? Pin
chand1021-May-07 23:39
chand1021-May-07 23:39 
AnswerRe: New line character in XML? Pin
andre_swnpl22-May-07 1:13
andre_swnpl22-May-07 1:13 
QuestionAvi video Pin
Henrix5521-May-07 23:26
Henrix5521-May-07 23:26 
AnswerRe: Avi video Pin
Christian Graus22-May-07 0:32
protectorChristian Graus22-May-07 0:32 
GeneralRe: Avi video Pin
Henrix5522-May-07 0:49
Henrix5522-May-07 0:49 
QuestionOracle client installed? Pin
User 269896721-May-07 23:03
User 269896721-May-07 23:03 
AnswerRe: Oracle client installed? Pin
Gareth H21-May-07 23:24
Gareth H21-May-07 23:24 
GeneralRe: Oracle client installed? Pin
User 269896722-May-07 0:46
User 269896722-May-07 0:46 
QuestionRe: Oracle client installed? Pin
User 269896723-May-07 2:03
User 269896723-May-07 2:03 
QuestionInstall Database into MSQL Server by C# code ? [modified] Pin
AlienPham21-May-07 22:21
AlienPham21-May-07 22:21 
AnswerRe: Install Database into MSQL Server by C# code ? Pin
blackjack215021-May-07 23:18
blackjack215021-May-07 23:18 
GeneralRe: Install Database into MSQL Server by C# code ? Pin
Giorgi Dalakishvili21-May-07 23:24
mentorGiorgi Dalakishvili21-May-07 23:24 

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.