Errors in VB code which I copied from a tutorial

ajcbutler

New member
Joined
Jun 26, 2019
Messages
2
Location
Nottingham, England
Programming Experience
Beginner
Hi guys

I am trying to learn my own code.

I have tried to make a form based on some tutorials.

4453


I have written the code as the tutorial said but I keep getting these errors.

Do you know what I am missing?

4454


I have tried Dim and I have tried declare for the error lines but it has not worked.



Any advise would be appreciated.

Thanks
Aaron
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,100
Location
Sydney, Australia
Programming Experience
10+
You can't just refer to things in your code that your application has no idea about. There are two main issues that you should address before any others.

The first one is that you are trying to use variables that you have never declared. You should consult that tutorial or another or just search the web to find out how to declare a variable. It's one of the first things any tutorial would teach because you can't do anything without variables.
I have tried Dim and I have tried declare for the error lines but it has not worked.
The Dim keyword is what you use to declare a variable so, if it didn't work, you did it wrong. If you don't show us what you did and, preferably, tell us what happened when you did it, we can't tell you what's wrong with it.

The second one is that you're trying to use types for MySQL databases that your project doesn't know exist. The .NET Framework has native types for SQL Server databases but MySQL databases will require a third-party component, i.e. Connector/Net from MySQL. You can either add that to your project as a NuGet package, which is probably the easiest way, or you can download and install it and then add the required reference directly. That said, do you actually have a MySQL database to connect to? People generally start with SQL Server because SQL Server Express LocalDB gets installed with VS.

Once you've got those issues sorted out, you should look at each of the remaining ones carefully. Read the error message and look at the code it refers to, then ask yourself what you're actually trying to do and what the code actually does. As an example, there's one there that indicates that you're trying to concatenate a String with a ComboBox control, which makes no sense and will definitely not be what the tutorial told you to do.
 
Top Bottom