Question The name 'NamedPipes' does not exist in the current context

CallMeJosh

New member
Joined
May 6, 2020
Messages
2
Programming Experience
Beginner
This is the code:
The error is 'The name 'NamedPipes' does not exist in the current context'.
Im new to this. So can anyone help me out? Thanks :D

C#:
        private void button1_Click(object sender, EventArgs e)
        {
            string text = fastColoredTextBox1.Text;
            this.api.SendLimitedLuaScript(text);

            if (NamedPipes.NamedPipeExist(NamedPipes.luapipename))
            {
                NamedPipes.LuaPipe(fastColoredTextBox1.Text);
            }
            else
            {
                MessageBox.Show("Please Attach First", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
            }
        }
 
Last edited by a moderator:
Welcome to the forums. (y)

Where exactly have you defined NamedPipes?

If its not defined you need to define it. If its defined. Then you may need to instantiate it or make the NamedPipes static.

Is this custom code or are you doing something with Interprocess Communications? If its the later, you need to create object references for your pipe.
 
Thanks!
um... the code is just for an execute button? Yeah i have actually not defined the pipe. But may i ask how to define it. (Sorry but I’m learning coding?)
 
What are you using to learn to code? Like what learning material?

To test with. Paste this into your namespace :
C#:
    public class Fudge
    {
        public string x;
        private void y()
        {

        }
    }
Next paste this method into a separate class to Fudge :
C#:
        internal static void Request_Response()
        {
            Fudge f = new Fudge
            {
                x = null,
                y.
            };
        }
Notice how x can be reached, but y. cannot?
The difference here is in the access modifiers : Public : Private - Read up on scopes on MSDN. You can find a link in my signature for Access Modifiers.

In your own code, one of your methods or properties likely has the wrong modifier.

If you didn't define it though, you'd likely be getting an error asking if you need to include an assembly reference or something to that effect... If NamedPipes didn't exist, you'd be getting a different error. I assume the later : .NamedPipeExist has an incorrect access modifier.

Further, if you write it like this and compare the compiler error message :
C#:
            Fudge f = new Fudge();
            f.x = null;
            f.y
You'll find the compiler is a bit more forthcoming afterwards with what the actual issue is with this snippet. The above snippet will complain explicitly about the protection level of the property or method you are trying to reach.
 
Back
Top Bottom