• All
  • Free Web Hosting
  • Category 2

Archives

gravatar

Firing Computation with mouse event in Extjs

Compute.on('mouseover', function(){                   
            var rate =   '.'+Ext.getCmp('rating1').getValue();
            var rate2 =  '.'+Ext.getCmp('rating2').getValue();
            var a = Ext.getCmp('part1').getValue() * rate;
            var b = Ext.getCmp('part2').getValue() * rate2;
            var c =    Ext.getCmp('score1').setValue(Ext.util.Format.number(a,'0.00'));
            var d =    Ext.getCmp('score2').setValue(Ext.util.Format.number(b,'0.00'));
            Ext.getCmp('total').setValue(Ext.util.Format.number(a+b,'0.00'));
        })

gravatar

Delete Data on MySql Database in Visual Basic Code

Author: Kevern
Date: 06/07/2011

The codes are declared on my module then being called via command button.

Option Explicit
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset


'Established the database connection.
Public Sub init()
       
    Set conn = New ADODB.Connection
    Set rs = New ADODB.Recordset
   
    conn.connectionString = ConnectionStringModule.connectionString
   
    With conn
    On Error GoTo errHandler
    .Open
    End With
    Exit Sub
errHandler:
    MsgBox Err.Description, vbCritical + vbOKOnly, "Warning"
End Sub

'Declare the delete code.
Public Sub DeleteMyData(MyData As String)
   init
   rs.Open "select * from DATA where DATA= '" & frmData.txtDATA& "'", conn, adOpenDynamic, adLockOptimistic
   MsgBox "Primary key of the recordset to be Delete: " & frmData.txtDATA, vbInformation, "My Data"
   'do delete code here
   rs.Delete
   rs.Close
   conn.Close

End Sub

Now on your vb6 form, call the module like this:

Call ModuleName.DeleteMyData(txtDATA.text)

'Populate your flexgrid if you have one. Like update data list on the flexgrid.
Call PopulateFlexgrid.FunctionPopulate("Your Query Here",Flexgrid1)

That's All Folks...

Reach me via email if you have questions, or simply add some comments here in this blog post. I will answer all your questions anytime, even if Im too busy.

Have a Good Day!

gravatar

Best Free Website Hosting

Guys,

Check Host1Free.com - free web hosting service! They really rocks! Got my website hosted in Host1Free.com and it's so fast that I could not believe that free web hosting could deliver such a download and upload speed. Host1Free.com is powered with cloud computing technologies those I think help to boost the performance. Click here to visit Host1Free.com

I may not a good blogger and an online money maker, but I tell you this is a great site, It can host all your php files for free. Believe me guys Im already a member.

gravatar

Creating DBInstance in PHP with Firebird Database

Im back! It's time to Code! Code! Code!, Let's say,......... Coding is much exciting than going to beach.... hahah, Anyway. Let's Start with the new coding technique.

CREATING DBINSTANCE in PHP with FIREBIRD DATABASE

<?php

class DBInstance{

    private static $instance;
   
    private static $engine;
    private static $dbkey;

    private static $database;
    private static $username;
    private static $password;
    private static $charset;
    private static $buffers;
    private static $dialect;
    private static $role;
    private static $port;
    private static $host;


    private static $message;


    protected function  __construct() {}
    protected function  __clone() {}

    public static function init(){
         $file = parse_ini_file("DBConnect/config.ini",true);
         try{
            self::$database = $file[self::$dbkey]['database'];
            self::$username = $file[self::$dbkey]['user'];
            self::$password = $file[self::$dbkey]['password'];
            self::$charset  = $file[self::$dbkey]['charset'];
            self::$buffers  = $file[self::$dbkey]['buffer'];
            self::$dialect  = $file[self::$dbkey]['dialect'];
            self::$role     = $file[self::$dbkey]['userrole'];
            self::$port     = $file[self::$dbkey]['port'];
            self::$host     = $file[self::$dbkey]['host'];
         }catch(Exception $e){
           self::$message = "config.ini cannot be found.";
         }

    }

    public static function setDBase($dbase){
        self::$dbkey = $dbase;
    }

    public static function setDBEngine($dbengine){
        self::$engine = $dbengine;
    }

    public static function getInstance(){
        if(!self::$instance){
            self::init();           
            if(self::$engine == "FireBird"){
                self::$instance = ibase_connect
                    (
                        self::$host . "/" . self::$port . ":" . self::$database,
                        self::$username, self::$password, self::$charset,
                        self::$buffers, self::$dialect, self::$role
                    );
                    self::$message = "You are now connected to systems database.";
                    if(ibase_errcode()){
                        self::$message = "Ooops... Something went wrong, Unable to establish database connection";
                    }
            }

            if(self::$engine == "MySQL"){
                 self::$message = "MySql Not yet been Implemented";
            }
        }
        return self::$instance;
    }
    public static function getDbError(){
        return self::$message;
    }
   
}
?>

gravatar

Kevern Solutions: Time To Relax! No Codes for a Week! Beach Time!

Kevern Solutions: Time To Relax! No Codes for a Week! Beach Time!: "For me as a peaceful person, I recommend this beach for those people who loves peace and solemn place to spend summer. This beach is located..."

gravatar

Time To Relax! No Codes for a Week! Beach Time!

For me as a peaceful person, I recommend this beach for those people who loves peace and solemn place to spend summer. This beach is located in the island of Philippines, The island name is Canigao Island, part of Matalom Leyte, Visayas Area. This beach is not yet fully developed, but cottages and shelters are available or D.I.Y., The thing is this island has no supply of electricity, but Electric Generators are being used during night to supply the Island Residents. Now this is Peace and quite for me. Anyway if you love music, you can bring your own, Now a days I don't anymore know if Hotels are available.




Things you may need if you visit this place:
12Volts Battert or any car Battery + Handy Power Converter (For Charging your Gadgets/Cellphones)
-Power Converter may be purchased at any Hardware Center (DIY stores/CD -R King)
Portable CD/DVD Players or Laptops
Portable Speakers/PC Speakers
Mosquito Repellents (OFF Lotions)
LED Lamps

gravatar

Kevern Solutions: Submit Banner (For Web Advertising) in PHP.

Kevern Solutions: Submit Banner (For Web Advertising) in PHP.: "This is a php based web program, no database included on this project, this system only upload specific images into you web server and send ..."

gravatar

Submit Banner (For Web Advertising) in PHP.

This is a php based web program, no database included on this project, this system only upload specific images into you web server and send confirmation massage to the user via auto email. System also limits the filesize upon upload and also user image gallery on page.

Screen Shots:

System Main Form1
Main Form
Data Entered
After Image Submission
User Checks His/Her Email
The Upload Summary
Download and extract 7zip file into your php root folder. Make sure that you have already configure your apache and php before extracting the file.

Good Luck!

Here is the link: http://www.4shared.com/dir/JgImBxI1/Banner_Advertising.html

gravatar

Kevern Solutions: Combo box validation in Javascript

Kevern Solutions: Combo box validation in Javascript: " This is a very simple way to check empty or invalid values in php Combo Boxes. Simple yet functional. Simply copy and paste this scrip..."

gravatar

Combo box validation in Javascript

 This is a very simple way to check empty or invalid values in php Combo Boxes. Simple yet functional. Simply copy and paste this script in,to your source code. This script is fully tested by me.

function ValidateCPA(calculate){

if (calculate.('cpa').chacked == false){
         alert ( "CPA Board Passer Information is required." );
         document.getElementById('cpa1').focus();
         return false;
         }
   
}

gravatar

Kevern Solutions: No numbers allowed in textbox in Javascript.

Kevern Solutions: No numbers allowed in textbox in Javascript.: " This script is very useful most specially if we want no numeric characters to be inputed in our textbox, and so, to eliminate those nu..."

gravatar

No numbers allowed in textbox in Javascript.

 This script is very useful most specially if we want no numeric characters to be inputed in our textbox, and so, to eliminate those numeric keys, just simply use this script. Thanks to the original author of this script.

function blockNonNumbers(obj, e, allowDecimal, allowNegative)
{
    var key;
    var isCtrl = false;
    var keychar;
    var reg;
       
    if(window.event) {
        key = e.keyCode;
        isCtrl = window.event.ctrlKey
    }
    else if(e.which) {
        key = e.which;
        isCtrl = e.ctrlKey;
    }
   
    if (isNaN(key)) return true;
   
    keychar = String.fromCharCode(key);
   
    // check for backspace or delete, or if Ctrl was pressed
    if (key == 8 || isCtrl)
    {
        return true;
    }

    reg = /\d/;
    var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
    var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
   
    return isFirstN || isFirstD || reg.test(keychar);
}

/*This script is running and tested by me personally.
*/

gravatar

Upload File Size Limit in IE.

function IELimmit()
{
    var myFSO = new ActiveXObject("Scripting.FileSystemObject");
    var filepath = document.calculate.uploaded_file.value;
    var thefile = myFSO.getFile(filepath);
    var size = thefile.size;
   
        if (size > 2097152) {
    alert ("Unable to proceed upload, File is larger than 2mb.\nPlease upload only files less than 2mb.");
    return false;
    }
    return true;
}

//this code is tested and running.

gravatar

Only five zeros as default in Javascript.

function removeZeros(){

          if (document.getElementById('SSS_No').value == '0'){
        document.getElementById(''SSS_No').value = '0'   
        }
       
         if (document.getElementById('sss_no').value == '00'){
         document.getElementById('sss_no').value = '00'
         }
       
         if (document.getElementById(''SSS_No').value == '000'){
         document.getElementById(''SSS_No').value = '000'
         }
       
         if (document.getElementById(''SSS_No').value == '0000'){
         document.getElementById(''SSS_No').value = '0000'
         }
       
         if (document.getElementById('sss_no').value == '00000'){
         document.getElementById('sss_no').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '0000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '00000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
          if (document.getElementById(''SSS_No').value == '000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
          if (document.getElementById(''SSS_No').value == '0000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '00000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '000000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
          if (document.getElementById(''SSS_No').value == '0000000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
          if (document.getElementById(''SSS_No').value == '00000000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }
       
         if (document.getElementById(''SSS_No').value == '000000000000000'){
         document.getElementById(''SSS_No').value = '00000'
         }

}
Here in this script, you must create a textbox, allow that textbox to be edited by the user, Now only five(5) zeros(0) will be accepted on that textbox, If the user inputed less or greater than five zeros and on lostfocus the textbox still gives a default of five zeros.

Try this script, and hope you can still develop this script.

Good Luck!!!

gravatar

Checking file size on upload in php

<?php
if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
  //Check if the file is JPEG image and it's size is less than 350Kb
  $filename = basename($_FILES['uploaded_file']['name']);
  $ext = substr($filename, strrpos($filename, '.') + 1);
  if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") &&
    ($_FILES["uploaded_file"]["size"] < 350000)) {
    //Determine the path to which we want to save this file
      $newname = dirname(__FILE__).'/upload/'.$filename;
      //Check if the file with the same name is already exists on the server
      if (!file_exists($newname)) {
        //Attempt to move the uploaded file to it's new place
        if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
           echo "It's done! The file has been saved as: ".$newname;
        } else {
           echo "Error: A problem occurred during file upload!";
        }
      } else {
         echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists";
      }
  } else {
     echo "Error: Only .jpg images under 350Kb are accepted for upload";
  }
} else {
 echo "Error: No file uploaded";
}
?>

gravatar

How to send mail in php?

<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = 'YourSite.com.ph' . "\r\n";
$email = "test@yahoo.com"; //you can make this a dynamic one.
$subject = "test";
$message = "Name:"
            . "       "
//            . $name
            . "\n"
            . "Age:"
            . "\n"
            . "Address:"
            . "        "
//            . $address
//            . "\n"
            . "Email:"
            . "    "
            . $email;
            . "\n"
            . "===================================================="
            . "\n"
            . "* This is a system-generated e-mail. Do not reply.
";

mail($email, $subject, $message, "From: $headers");
?>

gravatar

Kevern Solutions: how to loop years in php?

Kevern Solutions: how to loop years in php?: " Create a drop down or a combo box and insert the code below: Author: Kevern V. <?php &nbsp..."

gravatar

how to loop years in php?

 Create a drop down or a combo box and insert the code below:

Author: Kevern V.

 <?php
          echo "<select name='ins' id='ins' class='yearstyle' onchange=\"computeAge(this.value);\">";
          for($i=1950;$i<=date('Y');$i++){
           echo "<option value='" . $i . "'>" . $i . "</option>";

        }
        echo "<option value='select' selected>Year</option>";
           echo "</select>";
      ?>

//1950 is hard coded, depends on your starting year choice. just make sure that the present year is not hard coded so that it will change depends on the current year.

gravatar

Kevern Solutions: Limmiting File Types to be Uploaded in PHP?

Kevern Solutions: Limmiting File Types to be Uploaded in PHP?: "<script type='text/javascript'> function Checkfiles() { var fup = document.getElementById('uploaded_file'); var uploaded_file = fup.v..."

gravatar

Limmiting File Types to be Uploaded in PHP?


<script type="text/javascript">
function Checkfiles()
{
var fup = document.getElementById('uploaded_file');
var uploaded_file = fup.value;
var ext = uploaded_file.substring(uploaded_file.lastIndexOf('.') + 1);
if(ext == "doc" || ext == "JPG" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "pdf" || ext == "bmp" || ext == "BMP" || ext =="zip" || ext == "rar")
{
return true;
}
else
{
alert("Ooops! the file you are trying to upload is not supported!, Please upload only the supported file format.");
//fup.focus();
//return false;
document.getElementById('uploaded_file').value = "";
}
}
</script>

gravatar

Kevern Solutions: Checking two the same values in a Combo Box in Java...

Kevern Solutions: Checkin two the same values in a Combo Box in Java...: "The main purpose of this script is to determine that the values selected is already selected on the first selection, Let say we have created..."

gravatar

Checkin two the same values in a Combo Box in Javascript.

The main purpose of this script is to determine that the values selected is already selected on the first selection, Let say we have created a Two Combo Box that load data from MySql Database. (Auto Populate)

The Code:

function CheckSameData(){
if (document.getElementById('FirstSelection').value == document.getElementById('SecondSelection').value){
alert ("Selection is Already been Selected.");
document.getElementById('SecondSelection').focus();
document.getElementById('SecondSelection').style.color = '#FF0000'; //This will change the font color of the duplicating item.
return false;
}
return true;
}

gravatar

How to validate empty values in an array?

if (dml.elements[i].name=='Names[]')// Immediate Name
                {
               
                  // if exists do the validation and set the focus to the textbox
                     if (dml.elements[i].value=="")
                    {
                        alert("Your Name is Required!");
                        dml.elements[i].focus();
                        return false;           
                    }
                }

gravatar

Kevern Solutions: Show and Hide Text Box in Javascript.

Kevern Solutions: Show and Hide Text Box in Javascript.: "Show and hide a textbox by simply using this code. Fully compatible to all browsers. Thanks to the original author of this script. Insert t..."

gravatar

Show and Hide Text Box in Javascript.

Show and hide a textbox by simply using this code. Fully compatible to all browsers. Thanks to the original author of this script.

Insert this script in your <HEAD>.
<script type="text/javascript">
function doClick2(objRad3){
if (objRad3.value=="0"){
document.getElementById("textbox3").style.display='none'; //hide textbox
document.getElementById("otherOpt3").style.display='block'; //show other options
document.getElementById('CrimeDetails').value = 'N/A'; //this will be the default value upon dumping.
}
else{
document.getElementById("otherOpt3").style.display='none'; //hide other options
document.getElementById("textbox3").style.display='block'; //show textbox
document.getElementById('CrimeDetails').value = 'Please give details.';
}
}
</script>

gravatar

Kevern Solutions: How to detect a browser type in JavascriptV?

Kevern Solutions: How to detect a browser type in JavascriptV?: "I found this very useful script in the internet and I just want to share it's usability. This script can be applied if ever you want your sy..."

gravatar

How to detect a browser type in JavascriptV?

I found this very useful script in the internet and I just want to share it's usability. This script can be applied if ever you want your system to detect and inform the user that he or she is using an Internet Explorer Browser.

The Code:
<!--THIS WILL DETECT INTERNET EXPLORER BROWSERS-->
<script language="JavaScript"
type="text/JavaScript">

 if(navigator.appName == "Microsoft Internet Explorer")
{
 alert("This site works best with Mozilla Firefox.\nThank You!")
close();
}
</script>

Thanks to the Original Author.

gravatar

How to Accept Numeric Characters Only in Javascript?

Create a textbox in your HTML or PHP Program, Then insert this code after the HEAD on your HTML code.

<script language="JavaScript">
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}
</script>

gravatar

Kevern Solutions: Loading the Adobe Reader Plug-in in PHP.

Kevern Solutions: Loading the Adobe Reader Plug-in in PHP.: "<div id='template-template'> <div style='padding:10px;margin-top:50px'> &..."

gravatar

Loading the Adobe Reader Plug-in in PHP.

<div id="template-template">
    <div style="padding:10px;margin-top:50px">
        <object
            data="./files/usersmanual.pdf#toolbar=0"
            type="application/pdf"
            width="100%"
            height="580px">
            <p>Adober Reader plugin is missing. Please install plugin version 9 or higher.</p>
    </object>
    </div>
</div>



Make sure that you have already downloaded the adobe reader for php, you can download it from the internet. Just ask Google.

gravatar

Kevern Solutions: Defining Firefox and IE Browser Response

Kevern Solutions: Defining Firefox and IE Browser Response: " callback : function(options,success,result){ &nbsp..."

gravatar

Defining Firefox and IE Browser Response

 callback : function(options,success,result){
                var response = Ext.util.JSON.decode(result.responseText);

                if(response.success == true){

                    if(Ext.isIE){
                        messageBox(response.message, Ext.MessageBox.INFO);
                    }else{
                        successmessage(response.message);
                    }
                   
                }else{

                    if(Ext.isIE){
                        messageBox(response.errors.reason, Ext.MessageBox.ERROR);
                    }else{
                        errormessage(response.errors.reason);
                    }
                }
            }

gravatar

How to show search items or data in ExtJs

function showSearch(){
    var dataPanel = Ext.getCmp('details-grid');
    Ext.Ajax.on('beforerequest',function(conn,o,result){
        dataPanel.getEl().mask('Loading data...','x-mask-loading');
    })

    Ext.Ajax.on('requestcomplete',function(conn,o,result){
        dataPanel.getEl().unmask(true);
    })

    Ext.Ajax.on('requestexception',function(conn,o,result){
        dataPanel.getEl().unmask(true);
    })
    Ext.Ajax.request({
        url     : 'ajax/items.php',
        method  : 'POST',
        params  : {
        _method : "showitemlist",
        _class  : "itemlist",
        emp        :Ext.getCmp('itemCode').getValue().toUpperCase()
        },
        callback : function(options,success,result){
            var response = Ext.util.JSON.decode(result.responseText);

            if(response.success){

                store = new Ext.data.Store({
                      proxy  : new Ext.ux.data.PagingMemoryProxy(response.data),
                      reader : new Ext.data.ArrayReader({
                      fields : [
//From your Database Table
                         {name:'ITEMCODE'},
                         {name:'ITEMNAME'},
                         {name:'ITEMPRICE'},
                         {name:'ITEMDESC'},
                         {name:'ITEMREMARKS'},
                         {name:'QUANTITY'},
                         {name:'ISAVAILABLE'},
                         {name:'PURDATE'}
                      ]
                    })
                })
                store.loadData(response.data);
                store.load({params:{start:0, limit:14}});
            }else{
                Ext.MessageBox.show({
                    title   : 'e-Purchase',
                    msg     : response.errors.reason,
                    buttons : Ext.MessageBox.OK,
                    icon    : Ext.MessageBox.WARNING,
                    animEl  : document.body
                })
            }
        }
    })
}

gravatar

Removing HTML Editor's Toolbars in ExtJs

 {
                        xtype                       : 'htmleditor',
                        enableLinks             : false,
                        enableLists              : false,
                        enableSourceEdit    : false,
                        enableColors           : true,
                        enableFontSize        : true,
                        enableFormat          : false,
                        id                            : 'message',
                        width                       : 455,
                        height                      : 290,
                        fieldLabel                : 'Message',
}

gravatar

Setting Firebird Database Engine in PHP

<?php

    session_start(); //You can enable error reporting by setting value to 1

    error_reporting(0);

 //echo session_id();

    $_SESSION['currsession'] = session_id();

    if(isset($_SESSION['result_session'])){

        $endsession = $_SESSION['result_session'];

    }

    if($endsession == $_SESSION['currsession']){

        header('location:grades.php');

    }
   
    include_once("DBConnect/constants.php");
    include_once("DBConnect/DBInstance.php");
   
    DBInstance::setDBEngine(DBASE_ENGINE);
    DBInstance::setDBase(YOUR_DATABASE_NAME_HERE);
   
   
    $dbInstance = DBInstance::getInstance();
   
    $trans = ibase_trans(IBASE_DEFAULT,$dbInstance);
   
    $positionList= array();
    //if(isset($_POST["issubmit"])){
        //validation here.
       
        try{
               
                   
            $query = "Your Query Here";
           
            $pstmt = ibase_prepare($trans,$query);
            $result = ibase_execute($pstmt);
            if(!$result){
                throw new Exception(ibase_errmsg(),ibase_errcode());
            }
           
            while($row = ibase_fetch_object($result)){
           
                $positionList[]= array(
                    "position"=>$row->POSITION,
                    "description"=>$row->DESC
                );
            }
        //print_r($positionList);
       
            ibase_commit($trans);
        }catch(Exception $e){
            echo "No data dump to system database, Transaction has been rolled back.";
            echo $e->getMessage();
            ibase_rollback($trans);
           
        }
    //}
   
?>

Note: If you are using Linux Web Server make sure that you have a correct Systax in PHP.

gravatar

Kevern Solutions: Creating Triggers in Firebird Database

Kevern Solutions: Creating Triggers in Firebird Database: "Create a trigger in your database workbench name it 'Data_TrigerCreated' and the code below will automatically create a timestamp into you..."

gravatar

Creating Triggers in Firebird Database

Create a trigger in your database workbench name it "Data_TrigerCreated" and the code below will automatically create a timestamp into your table.
After you have created the trigger, you must name your field as the same what is below:
-CREATEDDATE
-CREATEDBY

The DDL:

/*
  You can change this template in the template editor:
  File | Preferences | Object Templates

  Trigger:

  Author   : KBVILLARUBIA
  Date     : 03/14/2011
  Purpose  :
*/
begin
     NEW.CREATEDDATE = 'NOW';
     NEW.CREATEDBY = user;
end

SAMPLE DATA WILL BE THE FF.:

CREATEDDATE              CREATEDBY
3/15/2011 6:10:59PM        ADMINISTRATOR

gravatar

Kevern Solutions: Graphics

Kevern Solutions: Graphics: "Asus Latest Graphics Adaptor
Enjoy 100% Blu-Ray Quality Audio with HDMI 1.3 Compliance
and Video Enhancement
The Essential Component ..."

gravatar

How to Create Class in Visual Basic 6.0

'#
'@author:Ken V.
'@date: November 13,2009
'@update: -
'@version: Ver 1.0.1
'#
Option Explicit
Private name As Integer
Private age As String
Private address As String


Public Property Let letbatchid(ByVal newbatchid As Integer)
    batchid = newbatchid
End Property
Public Property Get getbatchid() As Integer
    getbatchid = batchid
End Property

Public Property Let letbatchno(ByVal name As String)
    name= newname
End Property

Public Property Get getname() As String
    getname = name
End Property

Public Property Let letage(ByVal newage As String)
    age= newage
End Property

Public Property Get getaddress() As String
    getaddress= address
End Property

//This is just a simple example on how to create class in Visual Basic 6.0.


Enjoy!

gravatar

Kevern Solutions: Upload Data using Microsoft Excel in Visual Basic ...

Kevern Solutions: Upload Data using Microsoft Excel in Visual Basic ...: " Author: Ken V. Option Explicit Dim pricelistObj As PriceListObjectClass Dim xlconn As ADODB.Connection Dim xlrs As ADODB.Recordset..."

gravatar

Kevern Solutions: Using the RowColChange in Visual Basic 6.0 (The Ba...

Kevern Solutions: Using the RowColChange in Visual Basic 6.0 (The Ba...: "Click Image to Enlarge Author: Ken V. Private Sub MSHFlexGrid1_RowColChange() With MSHFlexGrid1 &nbs..."

gravatar

Using the RowColChange in Visual Basic 6.0 (The Basic)

Click Image to Enlarge
Author: Ken V.

Private Sub MSHFlexGrid1_RowColChange()
    With MSHFlexGrid1
       Text1.Text = .TextMatrix(.RowSel, 0)
        Text2.Text = .TextMatrix(.RowSel, 1)
        Text3.Text = .TextMatrix(.RowSel, 2)
        Text4.Text = .TextMatrix(.RowSel, 3)
        Text5.Text = .TextMatrix(.RowSel, 4)
        Text6.Text = .TextMatrix(.RowSel, 5)
        Text7.Text = .TextMatrix(.RowSel, 6)
        Text8.Text = .TextMatrix(.RowSel, 7)
        Text9.value = .TextMatrix(.RowSel, 8)
        Text10.Text = .TextMatrix(.RowSel, 9)
        Text11.Text = Format$(Val(.TextMatrix(.RowSel, 10)), "#0.00")

   End With
End Sub

gravatar

Upload Data using Microsoft Excel in Visual Basic 6.0 (MySql Database)

 Author: Ken V.


Option Explicit

Dim pricelistObj As PriceListObjectClass

Dim xlconn As ADODB.Connection
Dim xlrs As ADODB.Recordset

Dim rs As New Recordset

Dim gridToUpload As MSHFlexGrid

Dim col As Integer
Dim row As Integer

Public Sub initXL(xlApp As String)
    Set xlconn = New ADODB.Connection
    Set xlrs = New ADODB.Recordset
   
    With xlconn
        .Provider = "MSDASQL"
        .connectionString = "Driver={Microsoft Excel Driver (*.xls)};" & _
        "DBQ=" & xlApp & "; ReadOnly=False;"
        On Error GoTo errHandler
        .Open
    End With
   
    Exit Sub
errHandler:
    MsgBox Err.Description
End Sub

Public Sub populateUPLGrid(xlApp As String, grid As MSHFlexGrid)
    initXL (xlApp)
    grid.Clear
   
    With xlrs
        If .State = adStateClosed Then
            .Open "select * from [sheet1$]", xlconn, adOpenKeyset, adLockOptimistic
        End If
       
        Set grid.DataSource = xlrs
    
    End With
   
   
    Set gridToUpload = grid
End Sub
Public Sub updloadData(progress As ProgressBar, cmdUpload As CommandButton)
   
    Dim delay1 As Integer
    Dim delay2 As Integer
      
    progress.value = 0
   
    row = 1
   
    With gridToUpload
        cmdUpload.Enabled = False
        Do While row < .Rows
                //here I upload a list of price list into mysql database using the vb6 interface.
            setValues (row)
            Call RevisedTransModule.addPricelist(pricelistObj)
            For delay1 = 0 To 10000
                For delay2 = 0 To 1000
                Next delay2
            Next delay1
            progress.value = ((row + 1) / gridToUpload.Rows) * 100
           
            row = row + 1
        Loop
        cmdUpload.Enabled = True
    End With
    MsgBox "Data has been successfully uploaded!"
End Sub
Public Sub setValues(rowCount As Integer)
    Dim colName As String

    Set pricelistObj = New PriceListObjectClass

    With gridToUpload
        col = 0
        Do While col < (.Cols)
            colName = Trim(.TextMatrix(0, col))
            Select Case colName
                Case "Data1"
                    pricelistObj.letData1 = .TextMatrix(rowCount, col)
                Case "Data2"
                    pricelistObj.letData2 = .TextMatrix(rowCount, col)
                Case "Data3"
                    pricelistObj.letData3 = .TextMatrix(rowCount, col)
                Case "Data4"
                    pricelistObj.letData4 = .TextMatrix(rowCount, col)
                Case "Data5"
                    pricelistObj.letData5 = .TextMatrix(rowCount, col)
                Case "Data6"
                    pricelistObj.letData6 = .TextMatrix(rowCount, col)
                Case "Data7"
                    If .TextMatrix(rowCount, col) <> "" Then
                        pricelistObj.letData7 = .TextMatrix(rowCount, col)
                    End If
            End Select
            col = col + 1
        Loop
    End With
End Sub

Public Sub fromOjbToGrid(r_index As Integer, grid As MSHFlexGrid)
    Dim colName As String
   
    With grid
        col = 0
        Do While col < (.Cols)
            colName = Trim(.TextMatrix(0, col))
            Select Case colData
                Case "Data1"
                    .TextMatrix(r_index, col) = pricelistObj.getData1
                Case "Data2"
                    .TextMatrix(r_index, col) = pricelistObj.getData2
                Case "Data3"
                    .TextMatrix(r_index, col) = pricelistObj.getData3
                Case "Data4"
                    .TextMatrix(r_index, col) = pricelistObj.getData4
                Case "Data5"
                    .TextMatrix(r_index, col) = pricelistObj.getData5
                Case "Data6"
                    .TextMatrix(r_index, col) = pricelistObj.getData6
                Case "Data7"
                    .TextMatrix(r_index, col) = pricelistObj.getData7
            End Select
            col = col + 1
        Loop
    End With
End Sub
//here I make the Upload history, simple way in checking the uploaded data.
Public Sub checkUploaded(grid As MSHFlexGrid)
    grid.Clear
   
    Dim gridIndex As Integer
   
    gridIndex = 1
   
    grid.Rows = gridToUpload.Rows
    grid.Cols = gridToUpload.Cols
   
    For col = 0 To gridToUpload.Cols - 1
        grid.TextMatrix(0, col) = gridToUpload.TextMatrix(0, col)
    Next
   
   
   
    With gridToUpload
        row = 1
        Do While row < .Rows
            setValues (row)
            On Error Resume Next
            rs.Open "select * from DataTable where Data1='" & pricelistObj.getData1 & "' and Data2='" & pricelistObj.Data2 & "' and Data3='" & pricelistObj.getData3 & "'", conn, adOpenKeyset, adLockOptimistic
           
            If Not rs.EOF Then
                Set pricelistObj = New PriceListObjectClass
                pricelistObj.letData1 = rs!Data1                pricelistObj.letData2 = rs!Data2                pricelistObj.letdata3 = rs!Data3
                pricelistObj.letdata4 = rs!Data4
                pricelistObj.letData5 = rs!Data5
                pricelistObj.letData6 = rs!Data6
                pricelistObj.letData7 = rs!Data7
               
                Call fromOjbToGrid(gridIndex, grid)
                gridIndex = gridIndex + 1
            End If
            rs.Close
            row = row + 1
        Loop
    End With
End Sub

Public Sub checkRejected(grid As MSHFlexGrid)
    grid.Clear
   
    Dim gridIndex As Integer
   
    gridIndex = 1
   
    grid.Rows = gridToUpload.Rows
    grid.Cols = gridToUpload.Cols
   
    For col = 0 To gridToUpload.Cols - 1
        grid.TextMatrix(0, col) = gridToUpload.TextMatrix(0, col)
    Next
   
    With gridToUpload
        row = 1
        Do While row < .Rows
            setValues (row)
            On Error Resume Next
            rs.Open "select * from DataTable where Data1='" & pricelistObj.getData1 & "' and Data2='" & pricelistObj.getData2 & "' and Data3='" & pricelistObj.getData3 & "'", conn, adOpenKeyset, adLockOptimistic
           
            If rs.EOF Then
                Call fromOjbToGrid(gridIndex, grid)
                gridIndex = gridIndex + 1
            End If
            rs.Close
            row = row + 1
        Loop
    End With
End Sub

gravatar

Kevern Solutions: How to Enable Write in .INI File in Visual Basic 6...

Kevern Solutions: How to Enable Write in .INI File in Visual Basic 6...: "Option Explicit Public Function WriteIniValue(INIpath As String, PutKey As String, PutVariable As String, PutValue As String) Dim temp As S..."

gravatar

How to Enable Write in .INI File in Visual Basic 6.0

Option Explicit

Public Function WriteIniValue(INIpath As String, PutKey As String, PutVariable As String, PutValue As String)
Dim temp As String
Dim LcaseTemp As String
Dim ReadKey As String
Dim ReadVariable As String
Dim LOKEY As Integer
Dim HIKEY As Integer
Dim KEYLEN As Integer
Dim VAR As Integer
Dim VARENDOFLINE As Integer
Dim NF As Integer
Dim X As Integer

AssignVariables:
    NF = FreeFile
    ReadKey = vbCrLf & "[" & LCase$(PutKey) & "]" & Chr$(13)
    KEYLEN = Len(ReadKey)
    ReadVariable = Chr$(10) & LCase$(PutVariable) & "="
       
EnsureFileExists:
    Open INIpath For Binary As NF
    Close NF
    SetAttr INIpath, vbArchive
   
LoadFile:
    Open INIpath For Input As NF
    temp = Input$(LOF(NF), NF)
    temp = vbCrLf & temp & "[]"
    Close NF
    LcaseTemp = LCase$(temp)
   
LogicMenu:
    LOKEY = InStr(LcaseTemp, ReadKey)
    If LOKEY = 0 Then GoTo AddKey:
    HIKEY = InStr(LOKEY + KEYLEN, LcaseTemp, "[")
    VAR = InStr(LOKEY, LcaseTemp, ReadVariable)
    If VAR > HIKEY Or VAR < LOKEY Then GoTo AddVariable:
    GoTo RenewVariable:
   
AddKey:
        temp = Left$(temp, Len(temp) - 2)
        temp = temp & vbCrLf & vbCrLf & "[" & PutKey & "]" & vbCrLf & PutVariable & "=" & PutValue
        GoTo TrimFinalString:
       
AddVariable:
        temp = Left$(temp, Len(temp) - 2)
        temp = Left$(temp, LOKEY + KEYLEN) & PutVariable & "=" & PutValue & vbCrLf & Mid$(temp, LOKEY + KEYLEN + 1)
        GoTo TrimFinalString:
       
RenewVariable:
        temp = Left$(temp, Len(temp) - 2)
        VARENDOFLINE = InStr(VAR, temp, Chr$(13))
        temp = Left$(temp, VAR) & PutVariable & "=" & PutValue & Mid$(temp, VARENDOFLINE)
        GoTo TrimFinalString:

TrimFinalString:
        temp = Mid$(temp, 2)
        Do Until InStr(temp, vbCrLf & vbCrLf & vbCrLf) = 0
        temp = Replace(temp, vbCrLf & vbCrLf & vbCrLf, vbCrLf & vbCrLf)
        Loop
   
        Do Until Right$(temp, 1) > Chr$(13)
        temp = Left$(temp, Len(temp) - 1)
        Loop
   
        Do Until Left$(temp, 1) > Chr$(13)
        temp = Mid$(temp, 2)
        Loop
   
OutputAmendedINIFile:
        Open INIpath For Output As NF
        Print #NF, temp
        Close NF
   
End Function


Enjoy the code!

gravatar

How to Read .INI Files in Visual Basic 6

Option Explicit

Public Function ReadIniValue(INIpath As String, KEY As String, Variable As String) As String
Dim NF As Integer
Dim temp As String
Dim LcaseTemp As String
Dim ReadyToRead As Boolean
   
AssignVariables:
        NF = FreeFile
        ReadIniValue = ""
        KEY = "[" & LCase$(KEY) & "]"
        Variable = LCase$(Variable)
   
EnsureFileExists:
    Open INIpath For Binary As NF
    Close NF
    'SetAttr INIpath, vbArchive
   
LoadFile:
    Open INIpath For Input As NF
    While Not EOF(NF)
    Line Input #NF, temp
    LcaseTemp = LCase$(temp)
    If InStr(LcaseTemp, "[") <> 0 Then ReadyToRead = False
    If LcaseTemp = KEY Then ReadyToRead = True
    If InStr(LcaseTemp, "[") = 0 And ReadyToRead = True Then
        If InStr(LcaseTemp, Variable & "=") = 1 Then
            ReadIniValue = Mid$(temp, 1 + Len(Variable & "="))
            Close NF: Exit Function
            End If
        End If
    Wend
    Close NF
End Function

gravatar

Kevern Solutions: Reporting with Crystal Reports in vb6

Kevern Solutions: Reporting with Crystal Reports in vb6: "Private Sub cmdPrint_Click() Dim rsAccess_level As New ADODB.Recordset Dim rptApps As New CRAXDRT.Appl..."

gravatar

Reporting with Crystal Reports in vb6

Private Sub cmdPrint_Click()
    Dim rsAccess_level As New ADODB.Recordset
    Dim rptApps As New CRAXDRT.Application
    Dim rptReport As New CRAXDRT.Report
            With rsAccess_level
                If .State = adStateClosed Then
                    '.Open "Select * from Folder_Checklist where AcctName'" & txtCustName & "'", ConnModule.conn, adOpenDynamic, adLockOptimistic
                    .Open "Select * from Access_level", ConnModule.conn, adOpenDynamic, adLockOptimistic
                    On Error GoTo errHandler:
                End If
                        'Screen.MousePointer = vbHourglass
                        Set rptApps = CreateObject("CrystalRunTime.Application")
                        Set rptReport = rptApps.OpenReport(App.path & "\reports\Access_level_Rep.rpt")
                        frmReport.CRViewer91.ReportSource = rptReport
                             rptReport.Database.SetDataSource rsAccess_level
                             rptReport.PaperSize = crPaper10x14
                        On Err GoTo errHandler:
                        frmReport.CRViewer91.ViewReport
                        frmReport.CRViewer91.Refresh
                        frmReport.CRViewer91.Zoom 90
                        Screen.MousePointer = vbDefault
                        On Error GoTo errHandler:
            End With
            Exit Sub
errHandler:
        MsgBox Err.Description, vbCritical, "Access Level: Print Error"
End Sub

gravatar

How to trim textboxes in VB6?

 As part of the data validation, trimming of text space with in a textbox is very important.

Here is the Code:

If Trim(txtAccCode.Text) = "" Then
        MsgBox "Account Code is Required!", vbCritical, "MCRP - Access Level: Save Error"
        txtAccCode.SetFocus
        txtAccCode.BackColor = vbYellow
        Exit Sub
    End If

gravatar

How to search data in Visual Basic 6?

Adding a search button on your system is such a good idea, It depends on you what is "Searchable"  on your system, it can be: Customer Code/Item Code/Last Names/ etc.... Here in this method I used Customer No. as searchable string.

The Code:
Private Sub cmdsearchnow_Click()
Dim CN As ADODB.Connection
Dim rs As ADODB.Recordset
Dim Y As Integer
On Error Resume Next
OpenDataFiles CN, rs, "YOURDATABASE.MDB", "SELECT * FROM CUSSTOMERS ORDER BY LASTNAME"

If Not rs.BOF And rs.EOF Then
  rs.MoveFirst
End If
c = 0
Do While Not rs.EOF
 If rs!CustomerNo= txtSearchCustomer.Text Then
 

  With rs
    txtpassbookno.Text = !passbookno
'Place all rs here to appear on textbox after search.
        c = 1
     End With
 End If
    If c = 1 Then
          End If
rs.MoveNext
Loop
    If c = 0 Then 'if no match to the access database (return false)
       MsgBox "Sorry Record not found..."
       Exit Sub
    End If
' Call cleared 'this is optional, you can create on later.
End Sub

gravatar

How to populate combo box in Visual Basic 6?

Here in this source code sample we will discuss how to capture data from you Database Table and displays those data in a combo box.


In this method you can prevent data to be hard coded into your system, we will just have a lookup and displays those lookups in the combo box.

The Code:
First copy this code into your Modules

Option Explicit
    Dim conn As ADODB.connection
    Dim rs As ADODB.Recordset
-------------------------------------------------
' pupulate element
' @author: Ken
' @date: checkDate 07/28/2009
Public Sub init()
    Set conn = New ADODB.connection
    Set rs = New ADODB.Recordset
        conn.connectionString = connectionString.connectionString
            With conn
                On Error GoTo errHandler
                .Open
            End With
        Exit Sub
errHandler:
    MsgBox Err.Description, vbCritical + vbOKOnly, " Admin: Populate Element Module - Init"
End Sub

Public Sub populateCombo(KeyToCollect As String, dboQuery As String, combo As ComboBox)
    Call init
    combo.Clear
            With rs
                'On Error GoTo errHandler
                On Error Resume Next
                If .State = adStateClosed Then
                    .Open dboQuery, conn, adOpenKeyset, adLockOptimistic
                End If
                    Do While Not .EOF
                        combo.AddItem .Fields(KeyToCollect)
                        .MoveNext
                    Loop
                .Close
            End With
        conn.Close
    Exit Sub
errHandler:
    MsgBox Err.Description, vbCritical + vbOKOnly, "Admin: Populate Element MOdule - Populate Combo: Error"
End Sub

'Next is calling the module:
Call PopulateElement.populateCombo("Your Query Here")

Just Experiment on the code and you'll see the best of it.
Good Luck!!!!

gravatar

How to Validate textbox with Javascript?

This script checks if the text box has value or none. The text box that you are going to validate must be inside the form.

<script language="javascript" type="text/javascript">
<!-- hide script from older browsers
function validateForm(MyForm){

    if ("Username"==document.forms.MyForm.UserName.value){
    alert("Username is Required!");
    document.getElementById('UserName').style.color = '#FF0000';
    document.getElementById('UserName').focus();
    return false;
    }
}
</script>

gravatar

How to Connect Visual Basic 6 to MSAccess?

 I have created two types of connections string, first is the database file is targeted via patch provided.

Sub OpenDataFiles(ByRef adConnData As ADODB.Connection, ByRef adrsdata As ADODB.Recordset, ByVal adfile As String, ByVal squery As String)
Dim connstring As String
Set adConnData = New ADODB.Connection
If adfile = "" Then adfile = "c:\mydatabase\data.mdb"
connstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\" & adfile
adConnData.ConnectionString = connstring
adConnData.Open
adConnData.CursorLocation = adUseClient
Set adrsdata = New ADODB.Recordset
adrsdata.Open squery, adConnData, adOpenKeyset, adLockOptimistic
End Sub

Two, the Access database file is placed along the program folder.

Sub OpenDataFiles(ByRef adConnData As ADODB.Connection, ByRef adrsdata As ADODB.Recordset, ByVal adfile As String, ByVal squery As String)
Dim connstring As String
Set adConnData = New ADODB.Connection
connstring = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "database.mdb" adConnData.ConnectionString = connstring
adConnData.Open
adConnData.CursorLocation = adUseClient
Set adrsdata = New ADODB.Recordset
adrsdata.Open squery, adConnData, adOpenKeyset, adLockOptimistic
End Sub

Regardless of the path, you can specify it on the Visual Basic 6.0 Data Environment.

gravatar

How to configure the Apache Conf File?

Right after the installation it is now time to configure the conf file in order for the apache function with your php file. Please be reminded that here in this tutorial I used Apache 2.0.63 for 32bit. The httpd is located at this path, <C:\Program Files\Apache Group\Apache2\conf> or depends on you installation path upon installation.

Configuring the ServerRoot:
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "C:/Program Files/Apache Group/Apache2"

Configuring you ports:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 11.34.11.12:80
Listen 80

Configuring Server Admin and Server Name:
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin admin@yournetwork.com.ph

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName Your Machine Name.YourNetwork.com.ph:80

Configuring the document root:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog logs/access.log combined

This is for your virtual host but this is optional.
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

This is for the php5 Configurations:
# For PHP 5
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"

Testing your Apache HTTP Server:
Type: localhost to your browser's Address Bar.


If you see this in your browser. This means the apache service is running well and ready.


Good Luck and Have fun with Apache + php

gravatar

How to Populate MshFlexgrid in vb6

Create a module on your vb6 project and name that module PopulateGridModule. Then paste this code. Be sure that you have already established a database connection on you MySql or Access database. or else this method will not run.

Here is my connection type: Check it out for your reference.

Public Function connectionString()
    connectionString = "DRIVER={" & ReadIniValue(App.Path & "\conme.ini", "DEFAULT", "DRIVER") & "};" _
                      & "SERVER=" & ReadIniValue(App.Path & "\conme.ini", "DEFAULT", "HOST") & ";" _
                      & "DATABASE=" & ReadIniValue(App.Path & "\conme.ini", "DEFAULT", "DBNAME") & ";" _
                      & "UID=" & ReadIniValue(App.Path & "\conme.ini", "DEFAULT", "UID") & ";" _
                      & "PWD=" & ReadIniValue(App.Path & "\conme.ini", "DEFAULT", "PWD") & ";" _
                      & "OPTION=3"
End Function

A Simple reminder!, here in this connection string I used the conme.ini method.

Now this code will populate the MSHFlexGrid on your project.
Public Sub populateFlexGrids(dboQuery As String, grid As MSHFlexGrid)
    Call init
    grid.Clear
        With rs
            On Error GoTo errHandler
            .Open dboQuery, conn, adOpenKeyset, adLockOptimistic
            If rs.RecordCount = 0 Then
                MsgBox "No Data Found!", vbCritical, "POS Message:"
                Set grid.DataSource = rs
            Else
                Set grid.DataSource = rs
            End If
            .Close
        End With
        conn.Close
    Dim columnWidth As Double
    Dim counter As Integer
            columnWidth = (grid.Width / grid.Cols)
            If columnWidth <= 2000 Then
                columnWidth = 2000
            End If
            For counter = 0 To grid.Cols
                grid.ColWidth(counter) = columnWidth
            Next counter
        grid.Refresh
    Exit Sub
errHandler:
    MsgBox Err.Description, vbCritical + vbOKOnly, "Admin: Populate Element Module - Populate Flexgrid: Error"
End Sub

Then call this function:
Call PopulateGridModule.populateFlexgrids("Select * from YOUTABLE", MSHFlexgrid1)
Now you can put this code OnLoad or OnClick.

Good Luck!