Answer the question
In order to leave comments, you need to log in
How to properly declare variables in Visual Studio 2013?
I'm learning to program in Visual Studio according to the official lessons .
In lesson 11, the task is described, I wrote the following code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Example_11._1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Dim num1, num2, difference, product, quotient, As Single;
num1 = textBox1.Text;
num2 = textBox2.Text;
sum=num1+num2;
difference=num1-num2;
product = num1 * num2;
quotient=num1/num2;
label1.Text=sum;
label2.Text=difference;
label3.Text = product;
label4.Text = quotient;
}
}
}
Error 1 For, using, fixed and declaration statements cannot use more than one type
Dim num1, num2, difference, product, quotient, As Single;
Answer the question
In order to leave comments, you need to log in
Your "official lessons" are in BASIC, but you write in C#. different syntax. In C#, variables are declared like this:int num1, num2, difference, product, quotient;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question