user12646454
user12646454

Reputation:

Why I can't use Shell method in VB.NET?

I see everyone is using the Shell command without any problem, but it doesn't work for me, it says it's not declared like it doesn't exist. I'm working in Visual Studio using VB.NET.

image 1

image 2

Upvotes: 0

Views: 1595

Answers (2)

Heinzi
Heinzi

Reputation: 172380

Interaction.Shell is in the Microsoft.VisualBasic namespace, which should automatically be imported for Visual Basic projects.

If it isn't in yours, you can fix that in the project properties (Tab "References") or manually add Imports Microsoft.VisualBasic at the top of the code file.

Another possible reason is that Interaction.Shell is not included in .NET Core versions prior to 5. In that case, use a "classic" .NET Framework project or .NET 5 or higher instead. (Credit to Hans Passant in the comments.)

Upvotes: 2

user12646454
user12646454

Reputation:

I have recreated the app, without change anything and now it works... In any case, thank you to everybody for the support.

Upvotes: 0

Related Questions