Programming in VB.NET

Download Programming in VB.NET

Post on 08-Apr-2015

1.600 views

Category:

Documents

5 download

Embed Size (px)

DESCRIPTION

A complete reference for programming in VB.NETVisual Studio 2010VB.NET programming

TRANSCRIPT

<p>Programming in VB.NET</p> <p>Rohit BirlaRohitKumarBirla@gmail.com RohitBirla_rb@yahoo.com</p> <p>Your Success, Our Strength TM</p> <p>Rohit BirlaRohitKumarBirla@gmail.com RohitBirla_rb@yahoo.com</p> <p>2</p> <p>Your Success, Our Strength TM</p> <p>PrefaceIt gives me great pleasure in presenting this book. Programming in VB.NET is written with several goals in mind. It is designed to cover all essential and basic information you will need to start your programming in VB.NET. I hope this book will help you to start your programming in .NET. In spite of all efforts some errors might be there. I shall be grateful to the readers if the same are brought to my notice. Suggestions and comments for further improvements of the book will be gratefully acknowledged. June 29, 2010</p> <p>Rohit BirlaRohitKumarBirla@gmail.com RohitBirla_rb@yahoo.com</p> <p>3</p> <p>Your Success, Our Strength TM</p> <p>About the Author:Rohit Birla; is a student, currently perusing MCA. His area of interest includes Operating System Development and Windows Application Development. He is also the author of - Lets make Linux together - Program your Linux - Review VB6.0(Part-1)</p> <p>4</p> <p>Your Success, Our Strength TM</p> <p>Dedicate to The person who had given me the name `Rohit`</p> <p>5</p> <p>Your Success, Our Strength TM</p> <p>About the book:This book is designed especially for .NET beginners. Some of the main features include: A Totally programming approach Theory is kept to its minimum Every Topic is covered with Example Bundle of Assignments No Syntax Errors, Every code is shown as ScreenShot</p> <p>Before you start .NET, I expect you are comfortable with OOP concepts and VB Language.</p> <p>6</p> <p>Your Success, Our Strength TM</p> <p>Contents:PREFACE ................................................................................................................................................................ 3 ABOUT THE AUTHOR: ............................................................................................................................................ 4 ABOUT THE BOOK: ................................................................................................................................................. 6 CONTENTS: ............................................................................................................................................................ 7 .NET HISTORY ...................................................................................................................................................... 14 .NET HISTORY .............................................................................................................................................................14 APPLICATIONS THAT CAN BE DEVELOPED UNDER .NET ........................................................................................ 14 VISUAL STUDIO INTEGRATED DEVELOPED ENVIRONMENT .................................................................................. 14 WHY TO USE VS IDE ....................................................................................................................................................14 TYPES OF APPLICATIONS ...................................................................................................................................... 15 SINGLE TIER APPLICATIONS: ............................................................................................................................................15 TWO TIER APPLICATIONS: ..............................................................................................................................................15 FAT CLIENT: .......................................................................................................................................................15 FAT SERVER: .......................................................................................................................................................15 DIVIDING BUSINESS SERVICES BETWEEN USER AND DATA SERVICES: ................................................................................15 LIMITATIONS OF TWO TIER APPLICATIONS: .........................................................................................................................16 THREE TIER APPLICATIONS:.............................................................................................................................................16 N TIER APPLICATIONS: ................................................................................................................................................ 16 WHY TO USE .NET ................................................................................................................................................ 17 ADVANTAGES OF USING .NET FRAMEWORK ......................................................................................................................17 .NET ARCHITECTURE ............................................................................................................................................ 17 LAYER 1: ....................................................................................................................................................................18 LAYER 2: ....................................................................................................................................................................18 LAYER 3: ....................................................................................................................................................................18 MANAGE CODE ...........................................................................................................................................................18 GARBAGE COLLECTION PROCESS .....................................................................................................................................18 NAMESPACES: .............................................................................................................................................................19 ASSEMBLY: .................................................................................................................................................................19 MANAGE CODE EXECUTION PROCESS .................................................................................................................. 20 EXPLANATION: .............................................................................................................................................................20 FIRST VB.NET PROGRAM...................................................................................................................................... 21 HELLO WORLD AGAIN!!! ...............................................................................................................................................21 SECOND VB.NET PROGRAM ................................................................................................................................. 23 THIRD PROGRAM (USING STRUCTURES) .............................................................................................................. 24</p> <p>7</p> <p>Your Success, Our Strength TMUSING IF-ELSE ...................................................................................................................................................... 25 USING CONDITIONAL OPERATOR ......................................................................................................................... 25 LOOPING.............................................................................................................................................................. 26Assignment: ...................................................................................................................................................................... 26</p> <p>DEFINING ARRAYS &amp; FOR-EACH LOOP ................................................................................................................. 27 SUBROUTINE VS. FUNCTION ................................................................................................................................ 27 DEFINITION OF SUBROUTINE AND FUNCTION ......................................................................................................................28 MULTI DIMENSION ARRAYS ................................................................................................................................. 28 RETRIEVING LOWER AND UPPER BOUND ............................................................................................................................28Assignment ....................................................................................................................................................................... 28</p> <p>USING SELECT-CASE ............................................................................................................................................. 29 FUNCTION OVERLOADING ................................................................................................................................... 29Assignment ....................................................................................................................................................................... 30</p> <p>DEFINING CLASSES ............................................................................................................................................... 30 MAKING A SIMPLE CLASS................................................................................................................................................30 CREATING CONSTRUCTOR...............................................................................................................................................31 OVERLOADING CONSTRUCTOR ........................................................................................................................................32 DEFINING PROPERTIES...................................................................................................................................................33 OPERATOR OVERLOADING .................................................................................................................................. 34Assignment ....................................................................................................................................................................... 34</p> <p>INHERITANCE ....................................................................................................................................................... 35 CODE REUSABILITY ........................................................................................................................................................35 TYPES OF INHERITANCE ..................................................................................................................................................35 VARIABLE SCOPE ..........................................................................................................................................................35 HOW TO INHERIT..........................................................................................................................................................35 RUN TIME POLYMORPHISM ................................................................................................................................. 37 OBJECT SLICING, RUN TIME BINDING, LATE BINDING...........................................................................................................37 EXAMPLE ....................................................................................................................................................................37 MAIN1 ......................................................................................................................................................................37 MAIN2 ......................................................................................................................................................................38 RUN TIME POLYMORPHISM MAIN3 .................................................................................................................................38Assignment: ...................................................................................................................................................................... 39</p> <p>ABSTRACT CLASSES .............................................................................................................................................. 41 EXPLANATION: .............................................................................................................................................................41 EXAMPLE: ...................................................................................................................................................................41 INTERFACE ........................................................................................................................................................... 42</p> <p>8</p> <p>Your Success, Our Strength TMEXPLANATION: .............................................................................................................................................................42 ABSTRACT CLASS VS. INTERFACE ......................................................................................................................................42 EXAMPLE1 ..................................................................................................................................................................42 EXAMPLE2 IMPLEMENTING MULTIPLE INTERFACES ..............................................................................................................43 EXAMPLE3 INHERITING INTERFACES .................................................................................................................................44 NON INHERITABLE CLASS ..................................................................................................................................... 45 EXAMPLE ....................................................................................................................................................................45 ENUMERATION .................................................................................................................................................... 45 OVERRIDING TOSTRING () FUNCTION .................................................................................................................. 46 EXAMPLE: ...................................................................................................................................................................46 UNDERSTANDING CON...</p>