Where to ask C# questions?

Hello. I am trying to learn C# and I have some questions.
Does anyone know where I can ask these? Website, etc.

For anyone who can help here,

I'm having problems with this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using System;
using System.Windows.Forms;

namespace ButtonTest
{
    public class Test
    {
        static void Main()
        {
            Button button1 = new Button();

            Controls.Add(button1);
        }
    }
}


I want it to make a button, it says Controls isn't a function.
How about a forum which specialises in C#?

https://duckduckgo.com/?q=learn+C%23+forum
You could ask in the Windows Programming forum, since C# is something MS mashed together as part of .NET.

Don't expect a lot of answers, though. C# is still somewhat of a fringy Windows-based topic. That is changing, though.

There are compilers for other operating systems. The premiere compiler/IDE for the language is Visual Studio.
I suggest looking at a different tutorial. It's probably using some pre-made project template that already has some code-behind in it, but isn't explaining this to you.

this.Controls is a field inside an object of type Form, but
(1) Your class doesn't inherit from Form, and even if it did,
(2) You're attempting to use Controls from a static function unrelated to any Form class.

This webpage shows ways to create buttons using both the designer and directly within the C#:
https://www.geeksforgeeks.org/button-in-c-sharp/
Last edited on
As @salem c indicated:

https://lmddgtfy.net/?q=c%23%20forums
Thanks for answering. :D
Topic archived. No new replies allowed.