Enroller.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HRSYSTEMPROJECT
{
     class Enroller : IEnroll
    {
        #region IEnroll Members

        public String Enroll(String a,String b ,String c,String d,String e)
        {

            return a;
            return b;
            return c;
            return d;
            return e;
        }


        internal string[] Enroll()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}


Interface IEnroll.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HRSYSTEMPROJECT
{
    public interface IEnroll
    {
        String Enroll();
    }
}

Recommended Answers

All 8 Replies

Form1.cs
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 HRSYSTEMPROJECT
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }





        private void Form1_Load(object sender, EventArgs e)
        {
// TODO: This line of code loads data into the 'projectDataSet.EMPLOYEE' table. You can move, or remove it, as needed.
this.eMPLOYEETableAdapter.Fill(this.projectDataSet.EMPLOYEE);

        }



        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Enroller enrol = new Enroller();

            enrol.Enroll(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text);
            dataGridView1.Rows.Add(new Enroller().Enroll());


        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewCell oneCell in dataGridView1.SelectedCells)
            {
                if (oneCell.Selected)
                    dataGridView1.Rows.RemoveAt(oneCell.RowIndex);
            }
        }



    }

    public partial class Methods : Form1
    {




    }

}

It keeps saying that cannot implemenmt interface because it is not public. Why? What do I have to change?

Your interface defines a public String Enroll() without parameters. You do not have one.

So, what can you suggest to get rid of this error...

"Error 1 'HRSYSTEMPROJECT.Enroller' does not implement interface member 'HRSYSTEMPROJECT.IEnroll.Enroll()'. 'HRSYSTEMPROJECT.Enroller.Enroll()' cannot implement an interface member because it is not public.
"

dataGridView1.Rows.Add(new Enroller().Enroll());

Ok. Now how do I put the thrown textboxes to the datagridview?

I do not know. If your initial problem is solved, then it is good practice to mark this thread solved. Then start a new one for your new problem, explaining a little clearer what you have and what you want to happen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.