Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 20 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
20
Dung lượng
530,5 KB
Nội dung
aspnet Your First Web application Hà Đồng Hưng Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Visual Studio NET & VB.NET • IDE – Visual Studio NET – Visual Studio NET is an environment for developing Windows and Web applications • VB.NET – is just one of the languages you can use to program your applications • Visual Studio NET VB NET – Visual Studio NET is the environment that provides all the necessary tools for developing apps – The language is only one aspect of a Win/Web app Giới thiệu VMWare Workstation Project Types • Class library • Windows control library • Console application • Windows service • ASP.NET Web application • ASP.NET Web service • Web control library Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Your first Web app • We’ll develop a very simple application – to demonstrate not only the design of the interface – but also how to code the application Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Interface Design Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck 10 Giới thiệu VMWare Workstation Event handler • Code of Web (code behind) is made up of small code segments, called event handlers, which react to specific actions • An event handler is invoked automatically every time an event takes place • Example: We want to program the action of clicking the button When the user clicks the button, we want to execute some code that will display a message Tips: To insert some code behind the Button control, double-click the control and you’ll see the code window of the application 11 Giới thiệu VMWare Workstation Event handler • Code window 12 Giới thiệu VMWare Workstation Event handler 13 Giới thiệu VMWare Workstation Event handler • The name of the event handlers is made up of the name of the control, followed by an underscore and the name of the event • If there were another button on the form, the Button2 control, you’d have to write code for a subroutine that would handle the Button2.Click event 14 Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck 15 Giới thiệu VMWare Workstation VB.NET syntax • If statement – Syntax: If condition Then Do something Elseif Do something Else Do something End If 16 Giới thiệu VMWare Workstation VB.NET syntax –Example: 17 Giới thiệu VMWare Workstation VB.NET syntax • Dim statement • Common data types: Dim var As DataType Data types Range Context Dim cByte as Byte to 255 Used in bit/byte manipulations Dim Ip as Integer -32768 to 32767 loop variables, counters and small table indexes Dim Lval as Long -2,147,483,648 for indexes into large tables, file i/o, and to 2,147,483,647 other VB counters Dim Realone as Double Double is much more accurate and even runs about 10-20% faster than Single Dim curDate as Date Dim vString as String • Storing name, string Other datatypes: Single,Currency, Object, Variant, File… 18 Giới thiệu VMWare Workstation VB.NET syntax • For statement For CounterVar = StartNum To EndNum [Step StepNum] Do something Next [CounterVar] • While… End While While Do something End While • Do Until Do Until condition Do something Loop 19 Giới thiệu VMWare Workstation Recheck… • Write a function to calculate the expression: S=1+2+3+…+ (n-1)+ n ??? Private Sub btnShow_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnShow.Click Dim i As Integer Dim s As Long 'Init value for the sum s = 'Loop for calculating For i = To txtText.Text s = s + i Next 'Print the result Response.Write(s) End Sub 20 Giới thiệu VMWare Workstation ... Win /Web app Giới thiệu VMWare Workstation Project Types • Class library • Windows control library • Console application • Windows service • ASP.NET Web application • ASP.NET Web service • Web. .. Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Your first Web app • We’ll develop a very simple application – to demonstrate...Objectives • Introduction • Your First VB.NET app – Interface design – Coding – VB.NET syntax • Recheck Giới thiệu VMWare Workstation Objectives • Introduction • Your First VB.NET app – Interface