Click or drag to resize
Setting Up

To use the .NET SMS API for sending messages, you must already have the library downloaded. If you do not already have it, you can download the free .NET SMS API now to start sending messages. A reference to the library must be set in your project in order to use the types. After setting the reference to the library, the namespace can be used. Although this is optional, it enables us to use type names without preceding them with their namespaces.

using Zenoph.SMSLib;
using Zenoph.SMSLib.Enums;

It must be emphasised that Exception or SMSException may be thrown by methods called from the library. It is therefore necessary to wrap the code in Try Catch blocks in order to handle Exceptions that will be thrown.

try
{
    // Initialise SMS object and perform authentication.
    ZenophSMS sms = new ZenophSMS();
    sms.setUser("account_login");
    sms.setPassword("account_password");
    sms.authenticate();

    // the rest of the code continues.
}

catch (SMSException sex)
{
    // handle exception here
}

catch (Exception ex)
{
    // handle exception here
}

In the next pages which provide a quick guide on using the library, it is assumed that the example codes are wrapped in Try and Catch blocks where they are not explicitly done so.