Copyright © 2013-2014 MultiMedia Soft

How to use enumerated types

Previous pageReturn to chapter overviewNext page

The use of enumerated types improves the readability of your code and, thanks to the features offered by Microsoft's Intellisense, will ease the coding phase.

 

The following is the full list of enumerated types with their associated properties:

 

Enumerated type

Corresponding properties or parameters

enumDjcErrorCodes

LastError property and return value of most methods

enumDjcMidiKeyboardOrientations

MidiVirtualKeyboard.Create method

enumInfoStringType

MidiDevices.InfoGet and MidiDevices.InfoGetByUniqueId methods

enumMidiDevicesConfigChanges

MidiDevicesConfigChanged event

enumProfileInfoStringType

MidiDjConsole.ProfileInfoStringGet and MidiDjConsole.ProfileInfoStringSet methods

enumProfileItemInfoStringType

MidiDjConsole.ProfileItemInfoStringGet method

enumDjConsoleItemType

MidiDjConsole.ProfileItemAdd and MidiDjConsole.ProfileItemModify methods

enumInternalProfiles

MidiDjConsole.ProfileLoadInternal method

 

The following examples, under different development environments, show how to use enumerated types in your code.

 

Microsoft Visual Basic.NET

Microsoft Visual C#.NET

 

 

Microsoft Visual Basic.NET

 

After typing the code

 

If m_djConsole.LastError

 

press the "=" key on your keyboard: IntelliSense displays the list of possible values that can be assigned to a parameter passed to a method or to a property as seen on the screenshot below:

 

 

Select the m_djConsole.enumDjcErrorCodes.ERR_DJC_NOERROR value so the complete line of code will be:

 

If m_djConsole.LastError = enumDjcErrorCodes.ERR_DJC_NOERROR Then

 ' do something

 ...

Else

 ' do something else

 ...

End If

 

 

Microsoft Visual C#.NET

 

This environment requires a couple of additional lines of code to make use of Intellisense. First, you must add the components namespace to your code so the following line must be inserted at the beginning of the form management file:

 

using ActiveDjConsoleNetApi;

 

After typing the code...

 

if (m_djConsole.LastError ==

 

and pressing the space bar (blank character) Intellisense is activated and automatically displays the correct enumerated type as follows:

 

after selecting the enumDjcErrorCodes type, press the "." key on your keyboard so the list of available options is displayed as seen below:  

 

 

Select the ERR_DJC_NOERROR value so the complete line of code will be:

 

if (m_djConsole.LastError == enumDjcErrorCodes.ERR_DJC_NOERROR)

   // do something

   ....

else

   // do something else

   ....