Browse DevX
Sign up for e-mail newsletters from DevX


Creating a Windows Mobile Wireless Remote PowerPoint Clicker : Page 2






Creating the PowerPoint Remote Controller
  1. Label
  2. Button
  3. GroupBox



  • office.dll
  • Microsoft.Office.Interop.PowerPoint.dll


Imports Microsoft.Office.Interop.PowerPoint

Define the following enumerations:

Public Enum Directions PrevSlide NextSlide FirstSlide LastSlide End Enum

Declare the following member variables:

Public Class Form1 Private PowerPTApp As New Application Private PowerPTPres As Presentation '---total no. of slides--- Private TotalSlides As Integer = 0 '---serial port for Bluetooth comms--- Private WithEvents serialPort As New IO.Ports.SerialPort

In the Form1_Load event, code the following:

Private Sub Form1_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load btnSelect.Enabled = False GroupBox1.Enabled = False End Sub







'---delegate and subroutine to display slide no.--- Public Delegate Sub myDelegate(ByVal str As String) Public Sub UpdateLabel(ByVal str As String) lblSlideNo.Text = str End Sub


Private Sub Buttons_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles _ btnPrev.Click, btnNext.Click, btnLast.Click, btnFirst.Click Select Case CType(sender, Button).Name Case "btnPrev" NavigateSlides(Directions.PrevSlide) Case "btnNext" NavigateSlides(Directions.NextSlide) Case "btnFirst" NavigateSlides(Directions.FirstSlide) Case "btnLast" NavigateSlides(Directions.LastSlide) End Select End Sub


'---data received from Bluetooth serial port--- Private Sub DataReceived( _ ByVal sender As Object, _ ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _ Handles serialPort.DataReceived '---retrieve the command sent--- Dim command As String = serialPort.ReadLine() Select Case command Case "Prev" NavigateSlides(Directions.PrevSlide) Case "Next" NavigateSlides(Directions.NextSlide) Case "First" NavigateSlides(Directions.FirstSlide) Case "Last" NavigateSlides(Directions.LastSlide) End Select End Sub


'---when the app is closed, close the slide deck too--- Private Sub Form1_FormClosing( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.FormClosingEventArgs) _ Handles Me.FormClosing PowerPTApp.Quit() End Sub

