@NikitaSova

Как решить проблему CS1520?

Привет, форумчане!
Хотел сделать так что бы окно при запуске появлялось в углу экрана, но столкнулся с ошибкой CS1520 "Метод должен иметь тип возвращаемого значения". Пытался найти решение в интернете, но ничего не нашёл (возможно плохо искал), поэтому хотел спросить у вас. Надеюсь на вашу помощь)
код:
using System;
using System.Drawing;
using System.Windows.Forms;
class MyButtonClass : Form
{

    private TextBox FirstText, SecondText, ThirdText;


    private void InitializeComponent()
    {
        this.SuspendLayout();
        // 
        // MyButtonClass
        // 
        this.ClientSize = new System.Drawing.Size(284, 261);
        this.Name = "MyButtonClass";
        this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
        this.ResumeLayout(false);

    }

    int n, k, res, v;

    public MyButtonClass()
    {
        v = 0;

        this.Width = 296;
        this.Height = 525;

        FirstText = new TextBox();
        FirstText.Top = 10;
        FirstText.Left = 0;
        FirstText.Height = 50;
        FirstText.Width = 210;
        this.Controls.Add(FirstText);
        //Declare, properties and call a TextBox

        SecondText = new TextBox();
        SecondText.Text = $"";
        SecondText.Top = 50;
        SecondText.Left = 0;
        SecondText.Height = 50;
        SecondText.Width = 210;
        this.Controls.Add(SecondText);
        //Declare, properties and call a TextBox

        ThirdText = new TextBox();
        ThirdText.Text = $"0";
        ThirdText.Top = 100;
        ThirdText.Left = 0;
        ThirdText.Height = 50;
        ThirdText.Width = 210;
        this.Controls.Add(ThirdText);
        //Declare, properties and call a TextBox

    }
    public Form()
    {
        InitializeComponent();
        this.StartPosition = FormStartPosition.Manual;
        this.Location = new Point(0, 0);
    }
    static void Main()
    {
        Application.Run(new MyButtonClass());
        //starting objects of class MyButtonClass
    }
}
  • Вопрос задан
  • 507 просмотров
Решения вопроса 1
freeExec
@freeExec
Участник OpenStreetMap
Объявить тип, который метод возвращает или void если ничего не возвращает.
Но причём тут приведённый вами кусок кода?
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы