Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services.

Similar presentations


Presentation on theme: "Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services."— Presentation transcript:

1 Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services

2 12 Chapter 12: Cell Phone Applications and Web Services2 Objectives ►Create a Smartphone application ►Use a cell phone keypad for input ►Enter input using a Smartphone ►Enter other characters using the keypad ►Add Smartphone Toolbox objects

3 12 Chapter 12: Cell Phone Applications and Web Services3 Objectives ►Create a softkey menu ►Code the Smartphone application ►Display MessageBox objects in a Smartphone environment ►Find Web services

4 12 Chapter 12: Cell Phone Applications and Web Services4 Objectives ►Create a Web service connection ►Call a Web service method ►Create a Crystal report ►Display a Crystal report

5 12 Chapter 12: Cell Phone Applications and Web Services5 Introduction

6 12 Chapter 12: Cell Phone Applications and Web Services6 Creating a Smartphone Application ►With Visual Studio 2005 open, click the New Project button on the Standard toolbar, click Smart Device in the Project types pane on the left side of the New Project dialog box, and then, if necessary, click the plus sign next to Smart Device ►Click Smartphone 2003 under Smart Device in the Project types list. In the Templates pane, click Device Application (1.0) ►In the Name text box, change the name of the Smart Device application from DeviceApplication1 to TipCalculator. Click the OK button

7 12 Chapter 12: Cell Phone Applications and Web Services7 Creating a Smartphone Application

8 12 Chapter 12: Cell Phone Applications and Web Services8 Entering Input Using a Smartphone ►With the TipCalculator application open, name the Form object frmTip.vb. Title the Form object by changing the Text property to Tip Calculator. Add a Label object to the form named lblBillAmount. Change the Text property of the Label object to Amount of Bill. Drag a TextBox object under the Label object. Name the TextBox object txtBill. Clear the Text property. Resize the Label object to fit the text exactly. Center the Label and TextBox objects horizontally on the form ►Run the Smartphone application by clicking the Start Debugging button on the Standard toolbar ►Make sure Smartphone 2003 SE Emulator is selected, and then click the Deploy button ►To enter the bill amount of 75.22, press the 7 key on the keypad five times quickly. The letter “p” appears first, then the letter “q,” then the letter “r,” then the letter “s,” and lastly the number “7”. Next, press the 5 key on the keypad four times quickly to enter the number 5

9 12 Chapter 12: Cell Phone Applications and Web Services9 Entering Input Using a Smartphone ►To enter the decimal point, hold the # key in the lower- right corner of the keypad until the Symbols window opens ►To enter the decimal point, press the navigation keys, such as the right ARROW KEY and DOWN ARROW key, to move to the decimal point (period) in the Symbols window. To select the decimal point, press the Action key in the center of the navigation keys. Enter the digits 22 by first pressing the 2 key four times quickly. Wait a few seconds and press the 2 key four times quickly again to display the second 2 ►To close the application, click the Close button in the upper-right corner of the program window ►Click the No button, and then click the OK button

10 12 Chapter 12: Cell Phone Applications and Web Services10 Entering Input Using a Smartphone

11 12 Chapter 12: Cell Phone Applications and Web Services11 Adding Smartphone Toolbox Objects ►If necessary, open the TipCalculator application, which includes the first Label and TextBox object on the form. Drag a second Label object named lblPercentage to the form below the TextBox object. Change the Text property to Tip Percentage. Drag the ComboBox object to the Form object below the second label. Name the ComboBox object cboTipPercent. Click the ellipsis button to the right of the Items property. Enter the three tip percentage amounts into the String Collection Editor: 10% (press ENTER), 15% (press ENTER), and 20%. Resize the objects to the exact size of the text. Center both the Label and ComboBox objects on the center of the form

12 12 Chapter 12: Cell Phone Applications and Web Services12 Adding Smartphone Toolbox Objects ►Run the Smartphone application by clicking the Start Debugging button on the Standard toolbar. In the Deploy TipCalculator window, make sure the Smartphone 2003 SE Emulator option is selected, and then click the Deploy button. When the Smartphone emulator opens and loads the application, enter 75.22 in the first TextBox object using the keypad. To move to the ComboBox object for input, click the down arrow key on the navigation keypad. To view the ComboBox items, click the right arrow on the navigation keypad; 10% is displayed in the ComboBox object. Click the right arrow again to view 15%. Select the 15% tip percentage by clicking the Action button in the center of the navigation keypad. Close the Smartphone emulator without saving the emulator state

13 12 Chapter 12: Cell Phone Applications and Web Services13 Adding Smartphone Toolbox Objects

14 12 Chapter 12: Cell Phone Applications and Web Services14 Creating a Softkey Menu ►On the frmTip Form object of the TipCalculator application, click the left side of the Command control area ►Type Compute Tip in the Command control area. Press ENTER. Use the (Name) property to name the Command control area mnuComputeTip

15 12 Chapter 12: Cell Phone Applications and Web Services15 Coding the Smartphone Application ►In the TipCalculator application, double-click the mnuComputeTip Command control area in the lower-left corner of the Smartphone Form object ►Enter the code shown on the following slide to compute the tip for the restaurant bill amount

16 12 Chapter 12: Cell Phone Applications and Web Services16 Coding the Smartphone Application

17 12 Chapter 12: Cell Phone Applications and Web Services17 Program Design

18 12 Chapter 12: Cell Phone Applications and Web Services18 Program Design

19 12 Chapter 12: Cell Phone Applications and Web Services19 Designing the Program Processing Objects

20 12 Chapter 12: Cell Phone Applications and Web Services20 Finding Web Services ►With a new Windows Form object open with the project name CurrencyConverter, right-click the project name CurrencyConverter in the Solution Explorer ►Select Add Web Reference on the shortcut menu ►Enter the following Web service URL in the URL text box: http://www.webservicex.net/CurrencyConvertor.asmx?ws dl. Then click the Go button to connect to the Web service. You must be connected to the Internet to find the Web service. If the Web service is available online, a message appears stating the name of the method that will be used in the code window to call the existing Web service ►Click the Add Reference button in the Ad Web Reference window

21 12 Chapter 12: Cell Phone Applications and Web Services21 Finding Web Services

22 12 Chapter 12: Cell Phone Applications and Web Services22 Creating a Web Services Connection ►After creating the Web reference, open the code window to create an instance of the Web service class. To create an instance named wsMoney (where ws stands for Web service), type Dim wsMoney as New net. You include the word net because the Web reference listed in the Solution Explorer begins with the name net ►To complete the name of the Web service, type a period and webservicex appears in the IntelliSense window. Select webservicex, type a period, and www appears in the IntelliSense window. Select www and type another period ►Select the Web service named CurrencyConvertor in the IntelliSense window. Press the ENTER key

23 12 Chapter 12: Cell Phone Applications and Web Services23 Creating a Web Services Connection

24 12 Chapter 12: Cell Phone Applications and Web Services24 Calling a Web Service Method ►In the code window, assign a Double data type variable named dblConversionAmount. The data type is assigned as a Double because the Web reference stated that the return type is a Double data type ►The variable dblConversionAmount is assigned to the returned value from the calling method ConversionRate. ConversionRate is method of the instance of wsMoney. Type dblC and press CTRL+SPACEBAR to complete the variable dblConversionRate. Type = wsMoney. An IntelliSense list opens. Select ConversionRate, and then type a left parenthesis ( ►To convert U.S. dollars to euros, scroll down the list of first arguments and select net.webservicex.www.Currency.USD. Type a comma and the second list of arguments appears. Scroll down the list of second arguments and select net.webservicex.www.Currency.EUR for euros. Type a closing parenthesis

25 12 Chapter 12: Cell Phone Applications and Web Services25 Calling a Web Service Method

26 12 Chapter 12: Cell Phone Applications and Web Services26 Program Design

27 12 Chapter 12: Cell Phone Applications and Web Services27 Program Design

28 12 Chapter 12: Cell Phone Applications and Web Services28 Designing the Program Processing Objects

29 12 Chapter 12: Cell Phone Applications and Web Services29 Crystal Reports: Creating a Report ►Open Visual Studio using the Start button on the Windows taskbar and the All Programs submenu. Click the New Web Site button on the Standard toolbar. In the list of Visual Studio installed templates, click ASP.NET Web Site. Name the sample report PhysicianReferral. Click the OK button ►Right-click the project name PhysicianReferral in the Solution Explorer, and then click Add New Item on the shortcut menu. When the Add New Item window opens, click Crystal Report in the list of installed templates ►Click the Add button

30 12 Chapter 12: Cell Phone Applications and Web Services30 Crystal Reports: Creating a Report ►Click the OK button. Download the database named physicians.mdb from the scsite.com/vb2005/ch12 to a removable disk, such as a USB drive. Click the plus sign in front of Create New Connection to expand the options. Click the plus sign in front of Database Files. Browse to the physicians.mdb database and select the file. Click the Open button. Select the PhysicianList table and then click the Add (>) button in the center of the window ►Click the Next button. In the Fields dialog box of the Standard Report Creation Wizard, hold down the CTRL key and select the Physician Name, City, State, and Specialty fields. Click the Add (>) button in the center of the form ►Click the Next button. Click the Next button again to create a report without any groupings. Click the Next button again to create a report without a summary. If necessary, click the Next button again to create a report without any subsets. In the Report Style window, select the Red/Blue Border style ►Click the Finish button

31 12 Chapter 12: Cell Phone Applications and Web Services31 Crystal Reports: Creating a Report

32 12 Chapter 12: Cell Phone Applications and Web Services32 Displaying the Report ►Click the Default.aspx tab to open the Web form. Open the Crystal Reports category on the Toolbox by clicking the plus sign to expand the Crystal Reports category. Drag the CrystalReportViewer object onto the Default.aspx Web form ►If necessary, click the action button on the CrystalReportViewer object, and then click the Choose Report Source list arrow. Select. The Create Report Source window opens. Click the Specify Crystal Report for the CrystalReportSource control list arrow, and then select CrystalReport.rpt ►Click the OK button. Click the Start Debugging button on the Standard toolbar to execute the Web page. On the Debugging Not Enabled window, click the OK button

33 12 Chapter 12: Cell Phone Applications and Web Services33 Displaying the Report

34 12 Chapter 12: Cell Phone Applications and Web Services34 Summary ►Create a Smartphone application ►Use a cell phone keypad for input ►Enter input using a Smartphone ►Enter other characters using the keypad ►Add Smartphone Toolbox objects

35 12 Chapter 12: Cell Phone Applications and Web Services35 Summary ►Create a softkey menu ►Code the Smartphone application ►Display MessageBox objects in a Smartphone environment ►Find Web services

36 12 Chapter 12: Cell Phone Applications and Web Services36 Summary ►Create a Web service connection ►Call a Web service method ►Create a Crystal report ►Display a Crystal report

37 Microsoft Visual Basic 2005 CHAPTER 12 COMPLETE Cell Phone Applications and Web Services


Download ppt "Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services."

Similar presentations


Ads by Google