Creating an Ordering System Using EVB

This article describes the step-by-step application development for Microsoft Windows Pocket PC 2002 software development from Microsoft eMbedded Visual Basic. The EVB development kit enables users to provide the same development platform like VB so it very easy and fast to develop an application for a PDA, Pocket PC application.

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 26
August 18, 2004
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Development Kit and Download Resources

You need to download following software development kit and tool from Microsoft® site:

The Windows Mobile Developer Resource Kit can be purchased from:

http://msdn.microsoft.com/mobility/prodtechinfo/platforms/windowsmobile/resourcekit/default.aspx

Download sites:

1) Software Development Kit (eMbedded Visual Tools 3.0 - 2002 Edition) http://www.microsoft.com/downloads/details.aspx?familyid=f663bf48-31ee-4cbe-aac5-0affd5fb27dd&displaylang=en

2) Useful tools (Windows Mobile Developer Power Toys) from http://www.microsoft.com/downloads/details.aspx?familyid=74473fd6-1dcc-47aa-ab28-6a2b006edfe9&displaylang=en

Embedded Visual Tools 3.0 - 2002 Edition Installations

Core Requirement

Download Embedded Visual Tools 3.0 –2002 editions from Microsoft Site:

http://www.microsoft.com/downloads/details.aspx?familyid=f663bf48-31ee-4cbe-aac5-0affd5fb27dd&displaylang=en

Install on your desktop; this package includes EVB 3.0, EVC3.0 and Pocket PC 2002 SDK.

Sync Software

This software is required for synchronization software for Windows Mobile-based Pocket PCs from Desktop. Download from Microsoft site.

ActiveSync 3.7.1

http://www.microsoft.com/windowsmobile/resources/downloads/pocketpc/activesync37.mspx

Developers Power Toys for Pocket PC

Developers can view and access Pocket PC from this utility, and there many other functionality includes in this utility.

http://www.microsoft.com/downloads/details.aspx?familyid=74473FD6-1DCC-47AA-AB28-6A2B006EDFE9&displaylang=en

Runtime Lib for Pocket PC 2003

Download runtime type lib- for Pocket PC 2003 for evb3.0. If an application is developed under evb3.0 Env, then in Pocket PC 2003 we have to install run time type lib. Download from:

http://www.microsoft.com/windowsmobile/resources/downloads/developer/evb.mspx

Application Design

Start Application Design (Ordered Item Delivery System for Sales Person)

Purpose of application:

(Sales Person, Order Delivery System)

In this section, we start the application interface design and development of an application using EVB. We need a sample application from which a user can create a database for Pocket PC, log in to an application, enter data, save data, export data to a desktop, generate reports, and sync the Pocket PC application with the desktop utility.

Module 1) Pocket PC Software that runs as an application on a PDA.

Module 2) Pocket PC Application Desktop Utility that is used to import or export data from PDA to desktop.

Module 1 Design for PDA Application

Create an Ordering System Using EVB

Creating an Oreding System Using EVB

Creating an Oreding System Using EVB

Module 2 Pocket PC Application Desktop Utility

Module 2 Pocket PC Application Desktop Utility that is used to import or export data from a PDA to a desktop.

Application Development using EVB

All Code

Screen 1  (Login Screen)

Create an Ordering System Using EVB

Code:

''''' # EVB Code Started # ''''''''''''

''''' # Valiable Declaration # '''''''''''''
Option Explicit
Dim cn As Connection
Dim rs As Recordset
Dim tsql As String

''''' # Create Database
''''' # Ask Password at time of database creation
Private Sub btnCreateDatabase_Click()
    Dim ans As String
    ans = InputBox("Please enter password", "Admin login")
    If ans = "grep4u" Then
        Call CreateDatabase
        Exit Sub
    End If
End Sub

Private Sub btnExit_Click()
    App.End
End Sub

Private Sub btnLogin_Click()
    On Error GoTo 0
    Dim validUser As Boolean

    tsql = "select * from TUsers"
    Set rs = CreateObject("ADOCE.Recordset.3.0")
    rs.Open tsql
    validUser = False

    Do While Not rs.EOF
        If Trim(rs.Fields("UserName").Value) = Trim(txtUserName.Text) Then
            validUser = True
            rs.Close
            Set rs = Nothing
            Exit Do
        End If
        rs.MoveNext
    Loop
   
    If validUser = False Then
        MsgBox "Unable to login." & vbNewLine & "Please verify username and password.", vbCritical, "Login Error"
    Else
        frmAction.lblUsername.Caption = txtUserName.Text
        frmAction.Show
    End If
txtUserName.Text = ""
txtPassword.Text = ""

End Sub

Private Sub Form_Load()

End Sub

Private Sub Form_OKClick()
    App.End
End Sub

Private Sub CreateDatabase()

    On Error GoTo 0
    ''''' # Create Database
    Set rs = CreateObject("ADOCE.Recordset.3.0")
    rs.Open "CREATE DATABASE 'Medisoft.cdb'"

''''' # create table
    Set rs = CreateObject("ADOCE.Recordset.3.0")
    tsql = "create table TUsers ( UserName varchar(20),Password varchar(20) )"
    rs.Open tsql

    tsql = "create table Patient_Master ( PName varchar(20),PhoneNo varchar(20),Address varchar(100) )"
    rs.Open tsql
   
    tsql = "create table Patient_Tran ( T_id integer,T_Date DateTime,PName varchar(20),T_Delivery Bit,T_Collection Bit, Qty Integer, TankType varchar(20),UserName varchar(20) )"
    rs.Open tsql
''''' # insert Users data
'**************************
'Don't remove otherwise you will not be able access entire software
'**************************
    tsql = "insert into TUsers(UserName,Password) values('Admin','admin')"
    rs.Open tsql
'insert patient data
    tsql = "insert into Patient_Master(PName,PhoneNo,Address) values ('Pankaj Joshi','9820747561','c-5-7 3,3 sector 1-a cbd belapur')"
    rs.Open tsql
'insert transaction data
    tsql = "insert into Patient_Tran(T_id,T_Date,PName,T_Delivery ,T_Collection , Qty,TankType,UserName) values (1,#1-1-2004#,'Pankaj Joshi',1,0,2,'3M6','Admin')"
    rs.Open tsql
'rs.Close
    Set rs = Nothing
End Sub

Screen 2, the Main Screen

Screen 2 (Main Screen)

Creating an Ordering System Using EVB

Code:

Option Explicit
    Dim ttsql As String
    Dim Prs As Recordset

Private Sub btnClose_Click()
    frameActionChoice.Visible = True
    framePM.Visible = False
End Sub

Private Sub btnDC_Click()
    frmPM.UserName = lblUserName.Caption
    frmPM.Show
End Sub

Private Sub btnLogoff_Click()
    frmLogin.Show
    frmLogin.SetFocus
    frmLogin.txtUserName.Text = ""
    frmLogin.txtPassword.Text = ""
    frmLogin.txtUserName.SetFocus
End Sub

Private Sub btnPMaster_Click()
    'frmPM.Show
    frameActionChoice.Visible = True
    framePM.Visible = True
   
   
End Sub

Private Sub Form_Load()
    framePM.Visible = False
    frameActionChoice.Visible = True
    Call LoadData
End Sub

Private Sub LoadData()
    On Error GoTo 0
    Set Prs = CreateObject("ADOCE.RECORDSET.3.0")
    ttsql = "select PName from Patient_Master"
    Prs.Open ttsql
   
    Do While Not Prs.EOF
        cmbPatient.AddItem Trim(Prs.Fields("PName").Value)
        Prs.MoveNext
    Loop
    Prs.Close
    Set Prs = Nothing
End Sub

Private Sub cmbPatient_Click()
    Set Prs = CreateObject("ADOCE.RECORDSET.3.0")
    ttsql = "select PhoneNo,Address from Patient_Master where PName='" & Trim(cmbPatient.Text) & "'"
    Prs.Open ttsql
   
    If Not Prs.EOF Then
        txtPhoneNo.Text = Prs.Fields("PhoneNo").Value
        txtAddress.Text = Prs.Fields("Address").Value
    Else
        txtPhoneNo.Text = ""
        txtAddress.Text = ""
    End If
   
    Prs.Close
    Set Prs = Nothing
End Sub

Screen 3, the Customer Information

Screen 3  (Customer Information)

Create an Ordering System Using EVB

Code:

Option Explicit
    Dim ttsql As String
    Dim Prs As Recordset


Private Sub btnClose_Click()
    frameActionChoice.Visible = True
    framePM.Visible = False
End Sub

Private Sub btnDC_Click()
    frmPM.UserName = lblUserName.Caption
    frmPM.Show
End Sub

Private Sub btnLogoff_Click()
    frmLogin.Show
    frmLogin.SetFocus
    frmLogin.txtUserName.Text = ""
    frmLogin.txtPassword.Text = ""
    frmLogin.txtUserName.SetFocus
End Sub

Private Sub btnPMaster_Click()
    'frmPM.Show
    frameActionChoice.Visible = True
    framePM.Visible = True
   
   
End Sub

Private Sub Form_Load()
    framePM.Visible = False
    frameActionChoice.Visible = True
    Call LoadData
End Sub

Private Sub LoadData()
    On Error GoTo 0
    Set Prs = CreateObject("ADOCE.RECORDSET.3.0")
    ttsql = "select PName from Patient_Master"
    Prs.Open ttsql
   
    Do While Not Prs.EOF
        cmbPatient.AddItem Trim(Prs.Fields("PName").Value)
        Prs.MoveNext
    Loop
    Prs.Close
    Set Prs = Nothing
End Sub

Private Sub cmbPatient_Click()
    Set Prs = CreateObject("ADOCE.RECORDSET.3.0")
    ttsql = "select PhoneNo,Address from Patient_Master where PName='" & Trim(cmbPatient.Text) & "'"
    Prs.Open ttsql
   
    If Not Prs.EOF Then
        txtPhoneNo.Text = Prs.Fields("PhoneNo").Value
        txtAddress.Text = Prs.Fields("Address").Value
    Else
        txtPhoneNo.Text = ""
        txtAddress.Text = ""
    End If
   
    Prs.Close
    Set Prs = Nothing
End Sub

Private Sub framePM_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

End Sub

Screen 4, the User Information

Screen 4 (User Information)

Creating an Ordering Application with EVB

Code:

Option Explicit
Dim ssql  As String
Dim srs As Recordset
Public UserName As String


Private Sub btnClose_Click()
    frmAction.Show
End Sub

Private Sub btnSave_Click()
On Error GoTo 0
Dim Lid As Integer
If Trim(UserName) = "" Then
    MsgBox "Unable to save." & "You are logged in correctly", vbCritical, "Medisoft"
    Exit Sub
End If
    btnSave.Enabled = False
    lblTid.Caption = "Saving........."
    Set srs = CreateObject("ADOCE.RECORDSET.3.0")
    ssql = "select T_id from Patient_Tran order by T_id desc"
    srs.Open ssql
    If Not srs.EOF Then
        Lid = srs.Fields("T_id").Value + 1
    Else
        Lid = 1
    End If
   
    Set srs = CreateObject("ADOCE.RECORDSET.3.0")
    ssql = "insert into Patient_Tran(T_id,T_Date,PName,T_Delivery,T_Collection,Qty,TankType,UserName) values (" _
             & CStr(Lid) & ",#" & txtDate.Text & "#,'" & Trim(cmbPatient.Text) & "'," & chkDelivery.Value & "," _
             & chkCollection.Value & "," & txtQty.Text & ",'" & txtTankType.Text & "','" & UserName & "'" _
             & ")"
            
    srs.Open ssql
    lblTid.Caption = Lid
    btnSave.Enabled = True
    Set srs = Nothing
   
End Sub

Private Sub Form_Activate()
    Screen.MousePointer = vbNormal
    btnSave.Enabled = True

End Sub

Private Sub Form_GotFocus()
    Screen.MousePointer = vbNormal
    btnSave.Enabled = True

End Sub

Private Sub Form_Load()
On Error GoTo 0
    Call LoadData
    Screen.MousePointer = vbNormal
    btnSave.Enabled = True
End Sub

Private Sub LoadData()
   
    Set srs = CreateObject("ADOCE.RECORDSET.3.0")
    ssql = "select PName from Patient_Master"
    srs.Open ssql
   
   
    Do While Not srs.EOF
        cmbPatient.AddItem Trim(srs.Fields("PName").Value)
        srs.MoveNext
    Loop
    srs.Close
    Set srs = Nothing
End Sub


Private Sub frTran_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

End Sub

Application Testing and Deployment

Create an Ordering System Using EVB

Create an Ordering System with EVB

Conclusion

Developers can use the Windows Pocket PC 2002 Development kit and develop extreme level of usable application for industries on the fly with little knowledge of VB useful for EVB Development. This article is a basic overview of an application development. Developers can design complex application using the .Net framework for Pocket PC Development.

blog comments powered by Disqus
CODE EXAMPLES ARTICLES

- Bipartite Graphs
- Connectivity in Graphs
- The Ford-Fulkerson Algorithm
- Critical Paths
- The Bellman-Ford and Roy-Floyd Algorithms
- Shortest Path Algorithms in Graphs
- Minimum Spanning Tree
- Articulation Edges and Vertexes
- Circles and Connectivity in Graphs
- Depth-First Search in Graphs
- Breadth-First Search in Graphs
- The Prufer Code and the Floyd-Warshall Algor...
- An Insight into Graphs
- Coding a Custom Object with WSC
- Creating a Custom Object with WSC

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials