1800 87 7061 (Malaysia Toll Free) +603 2780 3880 (KL)
How to Check SMS Balance with C# - Version 2Below 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. ![]() 2. Balance will display inside a message box as shown below. Click "OK" to continue. ![]() 3. If you leave the username and password textbox blank, an error message will be shown as illustrated below. Click on "OK" to continue. ![]() Please click below to download demo files: Download C# Demo Scripts Download C# Installer Contact UsPlease 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:
Fax:
|