How to Check SMS Balance with C# - Version 2

Below is a sample of check SMS Balance scripts for C# (version 2) prepared by our iSMS team.


To understand more about our iSMS API Key features, please visit our Developer API page.


All available features and configurations will be displayed at the iSMS Developer API page. Integrate our SMS API into your C# application and enjoy our SMS services.

Please click below to find out about other programming language samples.



Download C# Demo Scripts   Download C# Installer


Please register HERE to be iSMS member to obtain your iSMS account username and password.


using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows.Forms;
using System.IO;
using Microsoft.VisualBasic;

namespace WindowsFormsApplication2
{
public partial class frmChkBal : Form
{
public frmChkBal()
{
InitializeComponent();
}

private void frmChkBal_Load(object sender, EventArgs e)
{
this.txtUser.Select();
}

private bool CheckErrors()
{
if (txtUser.Text.Trim() == String.Empty)
return true;
if (txtPass.Text.Trim() == String.Empty)
return true;
return false;
}
private void btnChkBal_Click(object sender, EventArgs e)
{
if (CheckErrors())
{
MessageBox.Show("Please enter Your Username & Password", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnClear.Visible = true;
txtPass.Clear();
txtUser.Clear();
txtUser.Select();
}
else
{
Uri url = new Uri("https://www.isms.com.my/isms_balance.php?un=" + txtUser.Text + "&pwd=" + txtPass.Text);
WebRequest myweb = WebRequest.Create(url);
WebResponse mywebres = myweb.GetResponse();
StreamReader read = new StreamReader(mywebres.GetResponseStream());
String balance_str = read.ReadToEnd();
MessageBox.Show(string.Format("Balance : {0}", balance_str), "User Balance", MessageBoxButtons.OK);
txtPass.Clear();
txtUser.Clear();
txtUser.Select();
btnClear.Visible = true;
btnClear.Enabled = true;
}
}

private void btnClear_Click(object sender, EventArgs e)
{
txtUser.Clear();
txtPass.Clear();
txtUser.Select();
}
private void txtUser_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnChkBal_Click(sender, e);
}
}

private void txtPass_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter){
btnChkBal_Click(sender, e);
}
}
}
}


1. To start, you have to fill in your iSMS username and password. Then, click on "Check Balance" button to check the balance.


If you have not registered, please click HERE to get a FREE account with iSMS.


Bulk SMS Malaysia - How to send sms using C#

2. Balance will display inside a message box as shown below. Click "OK" to continue.


Bulk SMS Malaysia - How to send sms using C#

3. If you leave the username and password textbox blank, an error message will be shown as illustrated below. Click on "OK" to continue.


Bulk SMS Malaysia - How to send sms using C#


Please click below to download demo files:


Download C# Demo Scripts   Download C# Installer


Contact Us

Please contact us HERE, if you have any enquiries or looking for any consultation.

Email: sales@mobiweb.com.my

Note to registered users: Please include your Username in the email.

Phone Numbers:

  • 1800 87 7061 (Malaysia Toll Free)
  • +604 642 0621 (Penang, Malaysia)
  • +603 2780 3880 (Line 1 Kuala Lumpur, Malaysia)
  • +603 7980 1388 (Line 2 Kuala Lumpur, Malaysia)

Fax:

  • +604 611 5620 (Penang, Malaysia)
  • +603 7980 2388 (Kuala Lumpur, Malaysia)

Articles

 

SMS Coverage for All Countries Worldwide

A B C D E F G H I J K L M N O P Q R S T U V Y Z
divider