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 Vishal Rajpara Rating: / 26 August 18, 2004
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:
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 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)
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'"
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
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)
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
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.