N
N
NikitaSova2020-09-02 10:03:48
C++ / C#
NikitaSova, 2020-09-02 10:03:48

How to solve the CS1520 problem?

Hi, forum users!
I wanted to make the window appear in the corner of the screen at startup, but I ran into error CS1520 "The method must have a return type." I tried to find a solution on the Internet, but I did not find anything (maybe I was looking badly), so I wanted to ask you. I hope for your help)
code:

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
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-09-02
@NikitaSova

Declare the type that the method returns or voidif nothing returns.
But what about the piece of code you provided?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question