Connect with Facebook Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-2008, 04:26 PM
Programmer
 
Join Date: Jun 2008
Location: California, USA
Posts: 191
Rep Power: 5
Siten0308 will become famous soon enough
Question help with listview project

Hello,

After further research and thanks to some posts you guys made, i was able to get very far, but now i have a problem, the problem is... the error message below:

inconsistant accessability: parameter type: predictionary.class1 is less accessible than method addtolistview... so i assume, ok maybe i should make class1 one a public, add public to class1 like so: public class class1, if i do that more ERRORS come!!! whats the deal?
the second error message is below:
cannot Convert Generic.KeyValuePair<int, class1> to picdictionary.class1, what am i doing wrong on that? i have the code below, class1, main form with the list view, and addform which you click the add button on main form and pops up addform with textboxes, when you click on submit, it goes back to main form, gets the info from the text boxes, and populates the listview.
class1
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace practicedictionary
{
    class class1
    {
        private int num;
        private static int num1;
        private string firstn;
        private string lastn;

        public class1()
        {
            num = num1;
            num1++;
            firstn = "";
            lastn = "";            
        }
        public string FirstN
        {
            get { return firstn; }
            set { firstn = value; }
        }
        public string LastN
        {
            get { return lastn; }
            set { lastn = value; }
        }
        public int Num
        {
            get { return num; }
            set { num = value; }
        }
    }
}
mainform
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace practicedictionary
{
    public partial class frmmain : Form
    {
        public frmmain()
        {
            InitializeComponent();
        }

        Dictionary<int, class1> dictionaryvar = new Dictionary<int, class1>();

        private void btnclose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnadd_Click(object sender, EventArgs e)
        {
            frmadd formadding = new frmadd();
            formadding.ShowDialog();
        }
        public void addtolistview(class1 iv)
        {
            dictionaryvar.Add(iv.Num, iv);
            Populatelistview();
        }

        public void Populatelistview()
        {
            listView1.Items.Clear();
            foreach (class1 i in dictionaryvar)
            {
                string[] newitem = { i.Num.ToString(), i.FirstN, i.LastN };
                ListViewItem lvi = new ListViewItem();
                lvi.Tag = i;
                clmnfirstn.ListView.Items.Add(lvi);
            }
        }

        private void frmmain_Load(object sender, EventArgs e)
        {

        }
    }
}
addform
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace practicedictionary
{
    public partial class frmadd : Form
    {
        public frmadd()
        {
            InitializeComponent();
        }

        private void btnsubmit_Click(object sender, EventArgs e)
        {
            class1 variables = new class1();
            variables.FirstN = txtbfirstn.Text;
            variables.LastN = txtblastn.Text;
            

            
            this.Close();
        }
    }
}
Also, is there an easier way to do what i wanted to do?

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-02-2008, 06:49 PM
Programmer
 
Join Date: Jun 2008
Location: California, USA
Posts: 191
Rep Power: 5
Siten0308 will become famous soon enough
Default Re: help with listview project

Hello Everyone,

Well for some strange reason, i tried to make class1 as public: public class class1, and now the error message went away that says: inconsistant accessability: parameter type: predictionary.class1 is less accessible than method addtolistview,

now i just need help for the foreach problem, which is the second error message,

cannot Convert Generic.KeyValuePair<int, class1> to picdictionary.class1

Please help : (
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeOrion (a non commercial, community game project, under development) MikkoM Video Game Talk 8 05-30-2009 11:56 AM
Send image one project to another ? nomanforu C# Programming 0 06-03-2008 12:12 AM
Contributing to a project Jordan Community Projects 7 09-15-2006 04:43 PM
Community Project! - Recent project gone sour Crane C# Programming 5 09-09-2006 02:13 PM


All times are GMT -5. The time now is 08:14 AM.

Freelance Jobs

XML/XSL: Need code for Book with Chapers using XML
Create an XML file for a book of your creation, and a basic CSS file that will format it to display ...
Earn: $40.00


C++/C: Simple firework cue sequencer
What I require is a rework of a simple cue sequencer. I have a piece of hardware (an Arduino boar...
Earn: $50.00


HTML/XHTML: Menu Rework - ASCIIBin
I'm placing this in the HTML/XHTML section of the Freelance site but you are not limited to HTML. Wh...
Earn: $20.00



CodeCall Goal

Goal #1: 1,000 Blogs
Goal #2: 1,000 Wiki Pages
Goal #3: 300,000 Posts
Goal #4: 20,000 Threads
Done: 30%, 23%, 55%, 75%

Ads