I'm not familiar with the syntax of the code in VB.NET and I want to use it to build the prototype of our system. I'm trying to practice some lines before I go with it and I'm having this error:
private void button1_Click(object sender, EventArgs e)
{
Dim Price As Integer
}
I got the code from the tutorials and the websites that I have visited but I don't know why it's showing errors, any ideas why?
CodePudding user response:
Your code has mix C# and Vb.net script. The part private void button1_Click(object sender, EventArgs e)
is a C# code while the Dim price as Integer
is a vb.net code.
To Fix your code please try this solution in C#.
private void button1_Click(object sender, EventArgs e)
{
int price;
}
In vb.net code should like this.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim price As Integer
End Sub
CodePudding user response:
This should resolve the error:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Price As Integer
End Sub