![](/images/new-backgrounds/1175219/175219783x1.webp)
Chapter 12: Customizing the Development Environment | 369 |
work on the file you ran it in. This problem doesn’t occur in the macro for VB. I’ll show you how to fix this problem, but let’s open the macro editor first.
You can open the Macro editor through VS by selecting Tools Macros Macros IDE, start a new project, add a module to the project, and add a Sub to the Module as a new macro. Then code the macro by typing DTE. and using Intellisense to find various parts of the IDE. The cryptic parameter to Windows.Item,
There is a problem with the macro for C# in Listing
C#:
using System;
namespace ConsoleApplication1
{
class Product
{
public int AddNewProduct(string productName)
{
int newProdID = 0;
//Logic to add product return newProdID;
}
}
}
VB (doesn’t have problem that occurs in C# code):
Public Class Product
Function AddNewProduct(ByVal productName As String) As Integer
Dim newProdID As Integer = 0