Convert Field to Property

Top  Previous  Next

 C#   VB.NET   VB6   VB5   VBA 

The Convert Field to Property feature allows you to easily convert a field (or selected group of fields) of a class such as:



public int Count;



Public Count As Integer

into a property such as:



private int m_count;


public int Count




return m_count;




m_count = value;





Private m_count As Integer


Public Property Count() As Integer



Return m_count

End Get


Set(ByVal value As Integer)

m_count = Value

End Set


End Property

[VB / VBA]


Private m_count As Integer


Public Property Get Count() As Integer
  Count = m_count
End Property

Public Property Let Count(ByVal Value As Integer)
  m_count = Value

End Property

Once you have put the cursor on the line with the field declaration (or selected the several lines with field declarations), MZ-Tools offers the following ways to convert it to a property:

  • The MZ-Tools | Convert Field To Property... menu.
  • The Convert Field To Property... menu entry on the context menu of a code window.
  • The Convert Field To Property button on the MZ-Tools - Main toolbar.
  • In Visual Studio, the keyboard shortcut associated with the MZTools8.ConvertFieldToProperty command.
  • In VB6 / VB5 / VBA, the keyboard shortcut associated with the Convert Field to Property feature.

Then, the line under the cursor will be parsed and the proper values will be filled in the New Method / Property Assistant window. When you click the Insert button, the field declaration is converted to a property.


  • You can customize the type tags preferences for member variables in the Options window, Team Options tab, Type Tags section.

See Also:

New Method / Property Assistant

Type Tags Options

Keyboard Shortcuts Options