Details

Beginning Visual Basic 2012


Beginning Visual Basic 2012


1. Aufl.

von: Bryan Newsome

34,99 €

Verlag: Wiley
Format: EPUB
Veröffentl.: 11.09.2012
ISBN/EAN: 9781118332047
Sprache: englisch
Anzahl Seiten: 744

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<b>The ultimate beginner's guide to programming in Visual Basic 2012</b> <p>Visual Basic, used to write Windows applications and web apps with ASP.NET, is an essential language for beginning programmers. Using the time-tested Wrox approach, this guide provides a step-by-step format that gets beginners up and running quickly and confidently. Essential topics covered include writing Windows applications, working with dialog boxes and menus, object oriented programming techniques, programming for graphics, using Visual Basic with ASP.NET for web apps, and dealing with data access and SQL Server.</p> <ul> <li>Visual Basic is a popular first language for beginning programmers; this Wrox beginner's guide covers all aspects of the newest version</li> <li>Uses a basic, step-by-step approach to help beginners learn quickly and easily</li> <li>Covers essential topics including flow control, data structure, writing Windows applications, error handling and debugging, objects and object oriented techniques, and class libraries</li> <li>Explains Windows Forms, graphics programming, accessing databases, web programming using Visual Basic with ASP.NET, data access, SQL Server, ADO.NET, and XML</li> </ul> <p><i>Beginning Visual Basic 2012</i> is a must-have for programming newcomers who want to get a solid footing in one of the most important programming languages.</p>
INTRODUCTION xxvii <p><b>CHAPTER 1: WELCOME TO VISUAL BASIC 2012 1</b></p> <p>Event-Driven Programming 2</p> <p>Installing Visual Basic 2012 3</p> <p>The Visual Studio 2012 IDE 6</p> <p>The Profile Setup Page 6</p> <p>The Menu 7</p> <p>The Toolbars 8</p> <p>Creating a Simple Application 9</p> <p>Windows in the Visual Studio 2012 IDE 10</p> <p>The Toolbox 14</p> <p>Modified Hungarian Notation 17</p> <p>The Code Editor 18</p> <p>Using the Help System 23</p> <p>Summary 23</p> <p><b>CHAPTER 2: THE MICROSOFT .NET FRAMEWORK 27</b></p> <p>Microsoft’s Reliance on Windows 28</p> <p>MSN 1.0 28</p> <p>The .NET Vision 29</p> <p>This Sounds Like Java 30</p> <p>Where Now? 30</p> <p>Writing Software for Windows 31</p> <p>The .NET Framework Classes 32</p> <p>Executing Code 33</p> <p>Common Language Runtime 34</p> <p>Code Loading and Execution 35</p> <p>Application Isolation 35</p> <p>Security 35</p> <p>Interoperability 36</p> <p>Exception Handling 36</p> <p>The Common Type System and Common Language Specification 37</p> <p>Summary 37</p> <p><b>CHAPTER 3: WRITING SOFTWARE 41</b></p> <p>Information and Data 41</p> <p>Algorithms 42</p> <p>What Is a Programming Language? 43</p> <p>Working with Variables 44</p> <p>Comments and Whitespace 46</p> <p>Comments 47</p> <p>Whitespace 48</p> <p>Data Types 49</p> <p>Working with Numbers 49</p> <p>Common Integer Math Operations 50</p> <p>Integer Math Shorthand 52</p> <p>The Problem with Integer Math 54</p> <p>Floating-Point Math 54</p> <p>Other States 56</p> <p>Single-Precision Floating-Point Numbers 56</p> <p>Working with Strings 57</p> <p>Concatenation 58</p> <p>Using the Concatenation Operator Inline 59</p> <p>More String Operations 59</p> <p>Substrings 61</p> <p>Formatting Strings 62</p> <p>Localized Formatting 63</p> <p>Replacing Substrings 64</p> <p>Using Dates 65</p> <p>Formatting Date Strings 66</p> <p>Extracting Date Properties 67</p> <p>Date Constants 68</p> <p>Defining Date Literals 69</p> <p>Manipulating Dates 70</p> <p>Boolean 71</p> <p>Storing Variables 71</p> <p>Binary 71</p> <p>Bits and Bytes 72</p> <p>Representing Values 73</p> <p>Converting Values 74</p> <p>Methods 76</p> <p>Why Use Methods? 76</p> <p>Methods You’ve Already Seen 77</p> <p>Building a Method 80</p> <p>Choosing Method Names 83</p> <p>Scope 84</p> <p>Summary 86</p> <p><b>CHAPTER 4: CONTROLLING THE FLOW 89</b></p> <p>Making Decisions 89</p> <p>The If Statement 90</p> <p>The Else Statement 92</p> <p>Allowing Multiple Alternatives with ElseIf 92</p> <p>Nested If Statements 94</p> <p>Single-Line If Statement 94</p> <p>Comparison Operators 94</p> <p>Using Not Equal To 94</p> <p>Using the Numeric Operators 96</p> <p>The And and Or Operators 99</p> <p>Using the And Operator 101</p> <p>More on And and Or 102</p> <p>String Comparison 103</p> <p>Select Case 104</p> <p>Case-Insensitive Select Case 108</p> <p>Multiple Selections 110</p> <p>The Case Else Statement 112</p> <p>Different Data Types with Select Case 112</p> <p>Loops 113</p> <p>The For…Next Loop 113</p> <p>Using the Step Keyword 116</p> <p>Looping Backward 117</p> <p>The For Each…Next Loop 118</p> <p>The Do…Loop Loops 119</p> <p>Do While…Loop 121</p> <p>Acceptable Expressions for a Do…Loop 123</p> <p>Other Versions of the Do…Loop 123</p> <p>Nested Loops 124</p> <p>Quitting Early 126</p> <p>Quitting Do…Loops 128</p> <p>Infinite Loops 129</p> <p>Summary 130</p> <p><b>CHAPTER 5: WORKING WITH DATA STRUCTURES 133</b></p> <p>Understanding Arrays 134</p> <p>Defining and Using Arrays 134</p> <p>Using For Each…Next 137</p> <p>Passing Arrays As Parameters 139</p> <p>Sorting Arrays 141</p> <p>Going Backward 142</p> <p>Initializing Arrays with Values 144</p> <p>Understanding Enumerations 145</p> <p>Using Enumerations 145</p> <p>Determining the State 149</p> <p>Setting Invalid Values 151</p> <p>Understanding Constants 152</p> <p>Using Constants 152</p> <p>Different Constant Types 154</p> <p>Structures 155</p> <p>Building Structures 155</p> <p>Adding Properties to Structures 158</p> <p>Working with ArrayLists 159</p> <p>Using an ArrayList 159</p> <p>Deleting from an ArrayList 163</p> <p>Showing Items in the ArrayList 166</p> <p>Working with Collections 167</p> <p>Creating CustomerCollection 168</p> <p>Adding an Item Property 170</p> <p>Building Lookup Tables with Hashtable 171</p> <p>Using Hashtables 172</p> <p>Cleaning Up: Remove, RemoveAt, and Clear 175</p> <p>Case Sensitivity 177</p> <p>Advanced Array Manipulation 179</p> <p>Dynamic Arrays 179</p> <p>Using Preserve 181</p> <p>Summary 182</p> <p><b>CHAPTER 6: EXTENSIBLE APPLICATION MARKUP LANGUAGE (XAML) 185</b></p> <p>What Is XAML? 186</p> <p>XAML Syntax 187</p> <p>Windows Presentation Foundation 190</p> <p>Creating a Rich WPF User Interface 191</p> <p>Using WPF Common Controls 197</p> <p>Wiring Up Events 201</p> <p>Summary 205</p> <p><b>CHAPTER 7: BUILDING WINDOWS APPLICATIONS 209</b></p> <p>Responding to Events 210</p> <p>Building a Simple Application 217</p> <p>Counting Characters 221</p> <p>Counting Words 223</p> <p>Creating More Complex Applications 229</p> <p>Creating the Toolbar 231</p> <p>Creating the Status Bar 235</p> <p>Creating an Edit Box 237</p> <p>Clearing the Edit Box 239</p> <p>Responding to Toolbar Buttons 242</p> <p>Using Multiple Forms 247</p> <p>About Dialog 247</p> <p>Summary 251</p> <p><b>CHAPTER 8: DISPLAYING DIALOGS 255</b></p> <p>The MessageBox 256</p> <p>Available Icons for MessageBox 256</p> <p>Available Buttons for MessageBox 257</p> <p>Setting the Default Button 257</p> <p>Miscellaneous Options 258</p> <p>The Show Method Syntax 258</p> <p>Example Message Boxes 260</p> <p>The OpenFileDialog Control 263</p> <p>The OpenFileDialog Control 264</p> <p>The Properties of OpenFileDialog 265</p> <p>OpenFileDialog Methods 266</p> <p>Using the OpenFileDialog Control 266</p> <p>The SaveDialog Control 271</p> <p>The Properties of SaveFileDialog 271</p> <p>SaveFileDialog Methods 273</p> <p>Using the SaveFileDialog Control 273</p> <p>The FontDialog Control 276</p> <p>The Properties of FontDialog 277</p> <p>The Methods of FontDialog 277</p> <p>Using the FontDialog Control 277</p> <p>The ColorDialog Control 280</p> <p>The Properties of ColorDialog 281</p> <p>Using the ColorDialog Control 282</p> <p>The PrintDialog Control 283</p> <p>The Properties of PrintDialog 284</p> <p>Using the PrintDialog Control 285</p> <p>The PrintDocument Class 285</p> <p>The Properties of the PrintDocument Class 285</p> <p>Printing a Document 285</p> <p>The FolderBrowserDialog Control 292</p> <p>The Properties of FolderBrowserDialog 292</p> <p>Using the FolderBrowserDialog Control 293</p> <p>Summary 296</p> <p><b>CHAPTER 9: CREATING MENUS 299</b></p> <p>Understanding Menu Features 299</p> <p>Images 300</p> <p>Access Keys 300</p> <p>Shortcut Keys 300</p> <p>Check Marks 300</p> <p>The Properties Window 301</p> <p>Creating Menus 302</p> <p>Designing the Menus 302</p> <p>Adding Toolbars and Controls 304</p> <p>Coding Menus 306</p> <p>Coding the View Menu and Toolbars 310</p> <p>Testing Your Code 311</p> <p>Context Menus 314</p> <p>Creating Context Menus 315</p> <p>Enabling and Disabling Menu Items and Toolbar Buttons 318</p> <p>Summary 321</p> <p><b>CHAPTER 10: DEBUGGING AND ERROR HANDLING 325</b></p> <p>Major Error Types 326</p> <p>Syntax Errors 326</p> <p>Execution Errors 330</p> <p>Logic Errors 330</p> <p>Debugging 331</p> <p>Creating a Sample Project 332</p> <p>Setting Breakpoints 348</p> <p>Debugging Using the Watch Window and QuickWatch Dialog Box 356</p> <p>Debugging with the Autos Window 358</p> <p>Debugging with the Locals Window 358</p> <p>Error Handling 360</p> <p>Using Structured Error Handling 361</p> <p>Summary 363</p> <p><b>CHAPTER 11: BUILDING OBJECTS 367</b></p> <p>Understanding Objects 368</p> <p>Encapsulation 369</p> <p>Methods and Properties 369</p> <p>Events 370</p> <p>Visibility 370</p> <p>What Is a Class? 371</p> <p>Building Classes 371</p> <p>Reusability 372</p> <p>Designing an Object 373</p> <p>State 374</p> <p>Behavior 374</p> <p>Storing State 375</p> <p>Real Properties 378</p> <p>Read/Write Properties 381</p> <p>Auto-Implemented Properties 384</p> <p>The IsMoving Method 384</p> <p>Constructors 386</p> <p>Inheritance 388</p> <p>Adding New Methods and Properties 389</p> <p>Adding a GetPowerToWeightRatio Method 392</p> <p>Changing Defaults 394</p> <p>Polymorphism: Scary Word, Simple Concept 395</p> <p>Overriding More Methods 396</p> <p>Inheriting from the Object Class 398</p> <p>Objects and Structures 399</p> <p>The Framework Classes 399</p> <p>Namespaces 399</p> <p>The Imports Statement 402</p> <p>Creating Your Own Namespace 402</p> <p>Inheritance in the .NET Framework 406</p> <p>Summary 407</p> <p><b>CHAPTER 12: ADVANCED OBJECT-ORIENTED TECHNIQUES 409</b></p> <p>Building a Favorites Viewer 410</p> <p>Internet Shortcuts and Favorites 410</p> <p>Using Classes 412</p> <p>Scanning Favorites 418</p> <p>Viewing Favorites 426</p> <p>An Alternative Favorite Viewer 428</p> <p>Building a Favorites Tray 428</p> <p>Displaying Favorites 429</p> <p>Using Shared Properties and Methods 433</p> <p>Using Shared Properties 434</p> <p>Using Shared Methods 438</p> <p>Understanding Object-Oriented Programming and Memory Management 439</p> <p>Garbage Collection 440</p> <p>Releasing Resources 441</p> <p>Defragmentation and Compaction 442</p> <p>Summary 443</p> <p><b>CHAPTER 13: BUILDING CLASS LIBRARIES 445</b></p> <p>Understanding Class Libraries 446</p> <p>Creating a Class Library 446</p> <p>Building a Class Library for Favorites Viewer 448</p> <p>A Multitiered Application 452</p> <p>Using Strong Names 453</p> <p>Signing Assemblies 453</p> <p>Assembly Versions 456</p> <p>Registering Assemblies 456</p> <p>Gacutil Utility 457</p> <p>Why Is My Assembly Not Visible in the References Dialog? 457</p> <p>Designing Class Libraries 457</p> <p>Using Third-Party Class Libraries 459</p> <p>Viewing Classes with the Object Browser 460</p> <p>Summary 461</p> <p><b>CHAPTER 14: CREATING WINDOWS FORMS USER CONTROLS 463</b></p> <p>Windows Forms Controls 464</p> <p>Creating and Testing a User Control 464</p> <p>Exposing Properties from User Controls 468</p> <p>Adding Properties 468</p> <p>Exposing Methods from User Controls 470</p> <p>Exposing Events from User Controls 471</p> <p>Design Time or Runtime 476</p> <p>Creating a Command Link Control 478</p> <p>Building the Command Link Control 479</p> <p>Using the Command Link Control 487</p> <p>Summary 490</p> <p><b>CHAPTER 15: ACCESSING DATA USING STRUCTURED QUERY LANGUAGE 493</b></p> <p>What You Need to Complete This Chapter’s Exercises 494</p> <p>What Is a Database? 495</p> <p>Database Tables 495</p> <p>Primary and Foreign Keys 500</p> <p>Understanding Primary Keys 500</p> <p>Understanding Foreign Keys 501</p> <p>Queries 502</p> <p>Understanding Basic SQL Syntax 503</p> <p>Using SELECT Statement 503</p> <p>Using the JOIN Statement 504</p> <p>Using the UPDATE Statement 505</p> <p>Using the DELETE Statement 506</p> <p>Using the INSERT Statement 507</p> <p>Using the SQL Comment 508</p> <p>Executing Queries in SQL Server 508</p> <p>Summary 511</p> <p><b>CHAPTER 16: DATABASE PROGRAMMING WITH SQL SERVER AND ADO.NET 515</b></p> <p>ADO.NET 516</p> <p>ADO.NET Data Namespaces 516</p> <p>The SqlConnection Class 517</p> <p>Working with the Connection String Parameters 518</p> <p>Opening and Closing the Connection 519</p> <p>The SqlCommand Class 519</p> <p>The Connection Property 520</p> <p>The CommandText Property 520</p> <p>The Parameters Collection 520</p> <p>The ExecuteNonQuery Method 521</p> <p>The SqlDataAdapter Class 522</p> <p>The SelectCommand Property 522</p> <p>Setting SelectCommand to SQL Text 523</p> <p>Setting SelectCommand to a Stored Procedure 523</p> <p>Using Command Builders to Create the Other Commands 524</p> <p>The Fill Method 524</p> <p>The DataSet Class 526</p> <p>DataView 526</p> <p>The Sort Property 527</p> <p>The RowFilter Property 527</p> <p>The Find Method 528</p> <p>The ADO.NET Classes in Action 528</p> <p>Data Binding 537</p> <p>BindingContext and CurrencyManager 538</p> <p>Binding Controls 539</p> <p>Binding Examples 539</p> <p>Summary 567</p> <p><b>CHAPTER 17: DYNAMIC DATA WEBSITE 571</b></p> <p>Creating a Dynamic Data Entities Website 571</p> <p>Customizing the Design of a Dynamic Data Website 577</p> <p>Page Templates 578</p> <p>Entity Templates 578</p> <p>Field Templates 578</p> <p>Filter Templates 579</p> <p>Summary 583</p> <p><b>CHAPTER 18: ASP.NET 587</b></p> <p>Thin-Client Architecture 588</p> <p>Web Forms versus Windows Forms 589</p> <p>Windows Forms Advantages 589</p> <p>Web Forms Advantages 589</p> <p>Web Applications: The Basic Pieces 590</p> <p>Web Servers 590</p> <p>Browsers 590</p> <p>HyperText Markup Language 591</p> <p>JavaScript 591</p> <p>Cascading Style Sheets 591</p> <p>Active Server Pages 592</p> <p>Benefits of ASP.NET Web Pages 592</p> <p>Special Website Files 592</p> <p>Global.asax 592</p> <p>Web.config 592</p> <p>Development 593</p> <p>Controls: The Toolbox 593</p> <p>Building Websites 593</p> <p>Creating a Web Form for Client- and Server-Side Processing 594</p> <p>Website Locations with VS 2012 599</p> <p>Performing Data Entry and Validation 602</p> <p>Site Layout, Themes, and Navigation 606</p> <p>Using the GridView to Build a Data-Driven Web Form 611</p> <p>Summary 616</p> <p><b>CHAPTER 19: DEPLOYING YOUR APPLICATION 619</b></p> <p>What Is Deployment? 620</p> <p>ClickOnce Deployment 620</p> <p>XCOPY Deployment 626</p> <p>Creating a Visual Studio 2012 Setup Application 626</p> <p>Customize the User Interface 632</p> <p>Deploying Diff erent Solutions 633</p> <p>Private Assemblies 633</p> <p>Shared Assemblies 634</p> <p>Deploying Desktop Applications 635</p> <p>Deploying Web Applications 635</p> <p>Deploying XML Web Services 635</p> <p>Useful Tools 635</p> <p>Summary 636</p> <p><b>CHAPTER 20: WINDOWS 8 APPS 639</b></p> <p>Windows 8 Application Design Principles 640</p> <p>Using Touch 640</p> <p>Application Commands 640</p> <p>Windows 8 Controls 642</p> <p>Creating your First Windows 8 App 643</p> <p>Application Layout 655</p> <p>Application Views 656</p> <p>Screen Sizes and Orientation 656</p> <p>Summary 661</p> <p>APPENDIX A: EXERCISE SOLUTIONS 665</p> <p>APPENDIX B: WHERE TO NOW? 679</p> <p>INDEX 683</p>
<p><b>Bryan Newsome</b> works as a senior programmer and analyst specializing in Microsoft solutions. He provides clients with solutions and mentoring on leading-edge Microsoft technologies. Bryan is a Microsoft Certified Application Developer for VB.NET.</p>
<p><b>Dive into the exciting world of Visual Basic programming</b></p> <p>Whether you want to create desktop programs, build web applications, or develop your own Windows 8 Apps, Visual Basic 2012 gets you there, and this book shows you how. With the help of step-by-step tasks and sample code, you'll be programming your first Visual Basic applications in no time. You'll gain a solid understanding of the language and progress to more advanced topics that take your skills to the next level. With your improved skill set, you'll be amazed by the solutions you can create.</p> <p><i>Beginning Visual Basic 2012:</i></p> <ul> <li>Takes you through the basics of writing software and controlling the flow of the program</li> <li>Describes how to work with data structures, use XAML, and build Windows® applications</li> <li>Covers debugging and the use of structured error handling</li> <li>Shows how to build class libraries, use strong names, and register assemblies</li> <li>Discusses database programming with SQL Server® and ADO.NET</li> <li>Explores the basic components of web applications and dives into building websites</li> <li>Examines the new style for developing Windows 8 touch applications</li> </ul> <p><b>wrox.com Programmer Forums</b></p> <p><b>Join our Programmer to Programmer forums to ask and answer programming questions about this book, join discussions on the hottest topics in the industry, and connect with fellow programmers from around the world.</b></p> <p><b>Code Downloads</b></p> <p>Take advantage of free code samples from this book, as well as code samples from hundreds of other books, all ready to use.</p> <p><b>Read More</b></p> <p>Find articles, ebooks, sample chapters and tables of contents for hundreds of books, and more reference resources on programming topics that matter to you.</p> <p><b>Wrox Beginning guides</b> are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that guides you through all the techniques involved.</p>

Diese Produkte könnten Sie auch interessieren:

Domain Architectures
Domain Architectures
von: Daniel J. Duffy
PDF ebook
31,99 €