Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regarding Modbus Pin
Wes Aday23-Aug-12 2:57
professionalWes Aday23-Aug-12 2:57 
AnswerRe: Regarding Modbus Pin
Eddy Vluggen23-Aug-12 3:02
professionalEddy Vluggen23-Aug-12 3:02 
GeneralRe: Regarding Modbus Pin
Wes Aday23-Aug-12 3:57
professionalWes Aday23-Aug-12 3:57 
GeneralRe: Regarding Modbus Pin
scottgp23-Aug-12 4:07
professionalscottgp23-Aug-12 4:07 
JokeRe: Regarding Modbus Pin
Mycroft Holmes23-Aug-12 12:53
professionalMycroft Holmes23-Aug-12 12:53 
AnswerRe: Regarding Modbus Pin
Mc_Topaz23-Aug-12 3:05
Mc_Topaz23-Aug-12 3:05 
AnswerRe: Regarding Modbus Pin
Pete O'Hanlon23-Aug-12 4:30
mvePete O'Hanlon23-Aug-12 4:30 
Questionpassing enum value to other method in different namespace Pin
Blubbo23-Aug-12 1:59
Blubbo23-Aug-12 1:59 
I'm not sure what I've gone wrong. It works ok in same namespace but not in different namespace. I use the dll calling to pass the enum value.

The compiler spat out 2 errors:
Error 1: The best overloaded method match for 'junkie.NewClass1.TestMethod(junkie.Output_State)' has some invalid arguments

Error 2: Argument 1: cannot convert from 'junk.Output_State' to 'junkie.Output_State'

sample code that I've written:

C#
using junkie;

namespace junk
{
    public enum Output_State
    {
        OFF,
        ON,
        Dont_Care,
    }

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void button1_Click(object sender, EventArgs e)
        {
            ClassTwo testClassTwo = new ClassTwo();
            testClassTwo.TestMethod(Output_State.Dont_Care);
        }
    }

    public class ClassTwo
    {
        junkie.NewClass1 testClassThree = new junkie.NewClass1();

        public void TestMethod(Output_State output)
        {
            testClassThree.TestMethod(output);
        }
    }
}


in a new class file:
C#
namespace junkie
{
    public enum Output_State
    {
        OFF,
        ON,
        Dont_Care,
    }

    class NewClass1
    {
        public void TestMethod(Output_State output)
        {
            switch (output)
            {
                case Output_State.ON: MessageBox.Show("ON"); break;
                case Output_State.OFF: MessageBox.Show("OFF"); break;
                case Output_State.Dont_Care: MessageBox.Show("Don't Care"); break;
                default: MessageBox.Show("HUH?"); break;
            }
        }
    }
}

AnswerRe: passing enum value to other method in different namespace Pin
Pete O'Hanlon23-Aug-12 2:03
mvePete O'Hanlon23-Aug-12 2:03 
GeneralRe: passing enum value to other method in different namespace Pin
Blubbo23-Aug-12 2:15
Blubbo23-Aug-12 2:15 
AnswerRe: passing enum value to other method in different namespace Pin
DaveyM6923-Aug-12 2:04
professionalDaveyM6923-Aug-12 2:04 
AnswerRe: passing enum value to other method in different namespace Pin
pramod.hegde23-Aug-12 20:21
professionalpramod.hegde23-Aug-12 20:21 
GeneralRe: passing enum value to other method in different namespace Pin
Blubbo27-Aug-12 2:04
Blubbo27-Aug-12 2:04 
QuestionLet Windows service OnStop() wait longer Pin
Mc_Topaz23-Aug-12 1:32
Mc_Topaz23-Aug-12 1:32 
AnswerRe: Let Windows service OnStop() wait longer Pin
Eddy Vluggen23-Aug-12 1:45
professionalEddy Vluggen23-Aug-12 1:45 
GeneralRe: Let Windows service OnStop() wait longer Pin
Mc_Topaz23-Aug-12 3:01
Mc_Topaz23-Aug-12 3:01 
GeneralRe: Let Windows service OnStop() wait longer Pin
Eddy Vluggen23-Aug-12 3:06
professionalEddy Vluggen23-Aug-12 3:06 
AnswerRe: Let Windows service OnStop() wait longer Pin
BobJanova23-Aug-12 2:37
BobJanova23-Aug-12 2:37 
GeneralRe: Let Windows service OnStop() wait longer Pin
Mc_Topaz23-Aug-12 3:03
Mc_Topaz23-Aug-12 3:03 
GeneralRe: Let Windows service OnStop() wait longer Pin
PIEBALDconsult23-Aug-12 3:06
mvePIEBALDconsult23-Aug-12 3:06 
GeneralRe: Let Windows service OnStop() wait longer Pin
Mc_Topaz23-Aug-12 3:39
Mc_Topaz23-Aug-12 3:39 
GeneralRe: Let Windows service OnStop() wait longer Pin
BobJanova23-Aug-12 3:37
BobJanova23-Aug-12 3:37 
AnswerRe: Let Windows service OnStop() wait longer Pin
jschell23-Aug-12 8:47
jschell23-Aug-12 8:47 
AnswerRe: Let Windows service OnStop() wait longer Pin
Vijay Selvaraj26-Aug-12 22:00
Vijay Selvaraj26-Aug-12 22:00 
QuestionSystem.Drawing.Pen-type property does not expand in property grid Pin
TetheredSun22-Aug-12 22:51
TetheredSun22-Aug-12 22:51 

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.