วันจันทร์ที่ 11 เมษายน พ.ศ. 2554

ASP.NET : Easy Visual Basic Part I

ASP.NET Textbooks shop

ASP.NET and VB

ASP.NET is the next generation of Active Server Pages (ASP) although ASP.NET will be called from ASP, but the two technologies are completely different. By Microsoft that has created a new ASP.NET based out of the Common Language Runtime (CLR), which allows developers to use any language supported by the Dot Net framework such as C # and VB. NET, etc. Currently the latest version of ASP.NET 4.0 which is included in the. NET Framework 4.0. And our chosen programming language for writing code in ASP.NET

ASP.NET Programming with VB


ASP.NET : Variable

Variable is a symbolic name associated with a value and whose associated value may be changed
Dim StatementThe Visual Basic compiler uses the Dim statement to determine the variable's data type and other information, such as what code can access the variable. The following example declares a variable to hold an Integer value.



Type

Mean

Example

Boolean

Boolean which is true and False.

Dim myBoolean1 As Boolean


Dim myBoolean2 As Boolean


myBoolean1 = True


myBoolean2 = False

Char

Represents a Unicode character

Dim myChar As Char


myChar = "C"

String

String message store.

Dim myString As String


myString = "Mr.Weerachai Nukitram"

Date

Keep the date format.

Dim myDate As Date


myDate = #12/12/2008#

DateTime

DateTime format stores the date and time

Dim myDateTime As DateTime


myDateTime = #12/12/2008 18:00:00#

Decimal

Decimal number stored with decimal

Dim myDecimal As Decimal


myDecimal = 123.456

Double

Represents a double-precision floating point number

Dim myDouble As Double


myDouble = 123.456

Integer

Integer store integer.

Dim myInteger As Integer


myInteger = 123

Long

Represents a 64-bit signed integer.

Dim myLong As Long


myLong = 123456.789

Object

Object Storage object or Object.

Dim myObject As Object


myObject = Object

Short

Represents a 16-bit signed integer.

Dim myShort As Short


myShort = 123456.789

Single

Represents a single-precision floating point number.

Dim mySingle As Single


mySingle = 1.0231

Array

Array variables keep the same group.

Dim myArray(2) as Integer

myArray(0) = 1

myArray(1) = 4

myArray(2) = 5



Dim myArray(2,2) as Integer

myArray(0,0) = 1

myArray(0,1) = 3

myArray(0,2) = 4

myArray(1,0) = 0

myArray(1,1) = 1

myArray(1,2) = 10

myArray(2,0) = 9

myArray(2,1) = 7

myArray(2,2) = 8

ASP.NET : Sub Procedure

ASP.NET Sub Procedure is part of a program that works within the Sub itself is reason to want to separate program running as a proportion Because of the variable Sub will not affect other parts of the program code to create the Sub can not be restored to Return to One can change the values ​​on the Argument ByRef.

Syntax
Sub mySub
.......
End Sub

Example
Sub MySub()
Me.lblText.Text = "Welcome To My World"
End Sub

ASP.NET : Function

ASP.NET Function is part of a program that works within itself and to Return values Back to the Call Function.

Syntax
Function myFunction
...
Return Value
End Sub

Example
Function MyFunction(ByVal num1 As Integer,ByVal num2 As Integer)
Return num1+num2
End Function


ASP.NET : ByRef & ByVal

ByRef and ByVal are supported Argument Argument Passing and Function in Sub used to deal with external variables into the work of the Sub and Function control to change the value of the variable , And fault-tolerance variable is returned.

ByRef = allowed to change the value of the variable that send in to Sub or Function Argument when Called.
ByVal = not allowed to change the value of the variable that send in to Sub or Function Argument when Called.

Example
Function MyFunction(ByVal num1 As Integer,ByRef num2 As Integer)
Return num1+num2
End Function


ASP.NET : Protected

Protected is scope of Method, Sub / Function that can run only in it's Sub / Function or class.
If another Class want to call it Can be run by Inherits Class.

Syntax
Public Class myClass1

Protected Sub mySub1
.....
End Sub

Protected Sub mySub2
.....
End Sub

End Class

---------------------
Public Class myClass2

Inherits myClass1

Sub newSub()
mySub1()
mySub2()
End Sub

End Class



ASP.NET : Public

Public is scope of the Method or the Sub / Function by the Public announced that the Sub / Function can run from external Class by new class or inherits Class.

Syntax
Public Class myClass1

Public Sub mySub1
.....
End Sub

Public Sub mySub2
.....
End Sub

End Class
---------------------
Public Class myClass2

Dim newClass As New myClass1

newClass.mySub1
newClass.mySub2

End Class



ASP.NET : Public Shared

Public Shared variables can be run from other Class without going through the New Class or Inherits Class

Syntax
Public Class myClass1

Public Shared Sub mySub1
.....
End Sub

Public Shared Sub mySub2
.....
End Sub

End Class
---------------------
Public Class myClass2

myClass1.mySub1()
myClass1.mySub2()

End Class



ASP.NET : Private

Private Sub / Class variables are defined, or make them available only it's Sub / Function, or Class but it can not be run from the others through the New Class, or any Inherits

Syntax
Public Class myClass1

Private Sub mySub1
.....
End Sub

Private Sub mySub2
.....
End Sub

Private Sub mySub3
mySub1()
mySub2()
End Sub

End Class



ASP.NET : Inherits

inheritance is a way to compartmentalize and reuse code by creating collections of attributes and behaviors called objects which can be based on previously created objects.

Syntax
Public Class myClass1

Protected Sub mySub1
.....
End Sub

Public Sub mySub2
.....
End Sub

End Class
---------------------
Public Class myClass2

Inherits myClass1

Sub newSub()
mySub1()
mySub2()
End Sub

End Class

End Asp.net Lesson 4.

วันศุกร์ที่ 1 เมษายน พ.ศ. 2554

ASP.NET : How to install SQL Server 2008 R2 Express

ASP.NET Textbooks shop


Microsoft SQL Server 2008 R2 Express

Microsoft SQL Server 2008 R2 Express is a free edition of SQL Server that is ideal for learning, developing and powering desktop, web and small server applications, and for redistribution by ISVs.
downlooad Microsoft SQL Server 2008 R2 Express

required program before install Microsoft SQL Server 2008 R2 Express

download Microsoft Windows Installer 4.5
download Windows PowerShell 1.0

How to install Microsoft SQL Server 2008 R2 Express




1. double Click SQLEXPRWT_x86_ENU.exe to start install




2. Select "New installation or add features to an existinginstallation"




3. click select "I accept the license terms."




4. click select "Select all" and click "Next"




5. The Instance Name can be set to Default instance or create an Instance the newly If the Default value when the run or Connect to SQL Server 2008 can run through a machine number or IP Address to it, but if the set Instance name is something else. The run will be run by IP \ Instance.




6. Account permissions




7.Choose a Mixed Mode (Windows Authentication and SQL Server Authentication) with the Password of the sa, and then click Add Current User.

Or if the Windows Authentication Mode is selected, it can make a change to a SQL Server Authentication from the article SQL Server 2008 Authentication Mode.





8. Click Next to go to the next step.





9. Click close to finish the installation.


End Asp.net Lesson 3.

วันอังคารที่ 29 มีนาคม พ.ศ. 2554

ASP.NET : How to install Visual Web Developer 2010 Express

ASP.NET Textbooks shop

ASP.NET with Visual Web Developer 2010 Express

Microsoft Visual Web Developer 2010 Express is a free and robust development environment for building, testing and deploying Web applications across the Microsoft Web Platform including ASP.Net, Internet Information Services and SQL Server. Unleash your creativity with powerful design surfaces for building standards-based Web applications and services.


With Visual Web Developer 2010 Express, you can work with Web Standards, JavaScript and ASP.NET. Work within a personalized environment, targeting established and emerging web technologies, including rich internet applications based on AJAX or Silverlight, cloud and web services. Integrated debugging tools let you find and fix bugs quickly and easily to help ensure high quality solutions.


Microsoft .NET Framework

Microsoft .NET is a software development platform based on virtual machine based architecture. Dot net is designed from the scratch to support programming language independent application development. The entire .NET programs are independent of any particular operating system and physical hardware machine. They can run on any physical machine, running any operating system that contains the implementation of .NET Framework. The core component of the .NET framework is its Common Language Runtime (CLR), which provides the abstraction of execution environment (Physical machine and Operating System) and manages the overall execution of any of the .NET based program.


download Microsoft .NET Framework Version 2.0 Redistributable Package (x86)
download Microsoft .NET Framework 3.5 Service pack 1 (Full Package)
download Microsoft .NET Framework 4

install Visual Web Developer 2010 Express

you can download and install Visual Web Developer 2010 Express by click link below
download Visual Web Developer 2010 Express


How to config IIS to support .NET 4.0



1. Click Start>setting>control panel




2. Open "Administrative tools" in Control Panel




3. Open "Internet Information Services"




4. first click at "Default Web Site" next click at "properties"





5. at tab "ASP.NET" change "ASP.NET version" to "4.0.30319"




6. if it do not have version "4.0.30319" fix it by Click Start>Run Type "c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" in TextBox and press OK to fix it


End Asp.net Lesson 2.

วันจันทร์ที่ 28 มีนาคม พ.ศ. 2554

ASP.NET : How to install IIS on Windows XP

ASP.NET Textbooks shop


What is asp.net?

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.


ASP.Net and IIS

IIS (Internet Information Server) is a group of Internet servers (including a Web or Hypertext Transfer Protocol server and a File Transfer Protocol server) with additional capabilities for Microsoft's Windows NT and Windows 2000 Server operating systems. IIS is Microsoft's entry to compete in the Internet server market that is also addressed by Apache, Sun Microsystems, O'Reilly, and others. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access database


Web developers can use Microsoft's Active Server Page (ASP)technology, which means that applications - including ActiveX controls - can be imbedded in Web pages that modify the content sent back to users. Developers can also write programs that filter requests and get the correct Web pages for different users by using Microsoft's Internet Server Application Program Interface (ISAPI) interface. ASPs and ISAPI programs run more efficiently than common gateway interface (CGI) and server-side include (SSI) programs, two current technologies. (However, there are comparable interfaces on other platforms.)


How to install IIS.



1. Click Start>setting>control panel


2. Open "Add orRemove Program"


3. Select "Add/Remove Windows Components"




4. mark in CheckBox "Internet Information Services(IIS)"
and Click Next




5. insert Windows installation Disk and select folder "i386" And click Next toward until Finish




6. Open "Administrative tools" in Control Panel




7. Open "Internet Information Services"




8. first click at "Default Web Site" next click at "properties"




9. if you don't want to use port at 80 can change it to other




10.Path rooth of web site at "c:\inetpub\wwwroot"




11. at Directory security click "Edit"




12. setup it same as picture




13. to test open "internet explorer" type "http://localhost/" and open it
if it work properly it appear same as picture




14. if it cannot work properly and it appear "Connect to ...." windows




15. click at tool select "Internet Option"




16. at tab "security" select "Custom Level"




17. at "User Authentication->logon" Select "Automatic logon with current user name and password" same as picture





18. test again with open "internet explorer" type "http://localhost/" and open it can work properly

Asp.net Lesson 1.