Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Similar documents
Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

To enter the number in decimals Label 1 To show total. Text:...

DRAWING AND MOVING IMAGES

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

Create a Windows Application that Reads- Writes PI Data via PI OLEDB. Page 1

How to Validate DataGridView Input

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3)

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

Chapter 2 Exploration of a Visual Basic.Net Application

1. Create your First VB.Net Program Hello World

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Mr.Khaled Anwar ( )

Learning VB.Net. Tutorial 10 Collections

How to work with data sources and datasets

DO NOT COPY AMIT PHOTOSTUDIO

Learning VB.Net. Tutorial 19 Classes and Inheritance

ADO.NET 2.0. database programming with

Revision for Final Examination (Second Semester) Grade 9

How to use data sources with databases (part 1)

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

"!#... )*! "!# )+, -./ 01 $

HOUR 4 Understanding Events

WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled.

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

Visual Basic 2008 Anne Boehm

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

Learning VB.Net. Tutorial 17 Classes

DEVELOPING OBJECT ORIENTED APPLICATIONS

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

I101/B100 Problem Solving with Computers

Lecture 10 OOP and VB.Net

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

A-1 LISTING PROGRAM. 1. Module1

Building Datacentric Applications

Chapter. Web Applications

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485)

MapWindow Plug-in Development

Building Windows Front Ends to SAS Software. Katie Essam Amadeus Software Limited 20 th May 2003

Data Access Standards. ODBC, OLE DB, and ADO Introduction. History of ODBC. History of ODBC 4/24/2016

Else. End If End Sub End Class. PDF created with pdffactory trial version

This PDF was generated in real-time using DynamicPDF; Generator for.net.

How to Create a MindManager Add-in With Visual Studio in 7 Steps

Hands-On Lab. Lab: Client Object Model. Lab version: Last updated: 2/23/2011

LEARN TO DEVELOP A LIVE PROJECT AS PER IT STANDARDS. Module 1: What we are going to Learn. Prerequisites

Office 365 FAQs. Focused Inbox

GUI Design and Event- Driven Programming

MATFOR In Visual Basic

ComponentOne. DataObjects for.net

Lab 4: Adding a Windows User-Interface

ComponentOne. MultiSelect for WinForms

A Complete Tutorial for Beginners LIEW VOON KIONG

Interacting with External Applications

بسم هللا الرحمن الرحيم المحاضرة السابعة مستوى ثالث علوم حاسوب برمجة مرئية 2 )عملي ) جامعة الجزيرة محافظة اب الجمهورية اليمنية النافذة الرئيسية

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Client/Server Architectures. Part (I of?) (Lecture Notes 5A)

Loops. In Example 1, we have a Person class, that counts the number of Person objects constructed.

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1

Private Sub MenuUtamaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.ShowDialog() End Sub

Lab 3 The High-Low Game

Upgrading Distributed Applications

Tutorial 03 understanding controls : buttons, text boxes

Repetition Structures

C16 Visual Basic Net Programming

Configuring RentalPoint Web Services

Programming with Visual Studio Higher (v. 2013)

S.2 Computer Literacy Question-Answer Book

Activating AspxCodeGen 4.0

LAMPIRAN. Universitas Sumatera Utara

The New Brew-CQ Synchronous Sockets and Threading

ComponentOne. DataObjects for.net

.NET and DB2 united with IBM DB2.NET Data Provider Objectives :.NET ADO.NET DB2 and ADO.NET DB2 - ADO.NET applications

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

IOS Plus Trade - Web Services Version 4 Walkthrough

IRESS Depth - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IRESS Depth information

BETA CHAPTER. Creating Custom Modules

Connecting Buildxact with MYOB

โปรแกรมช วยทดสอบหม อแปลงกระแส

CT862 Section 1 Introduction

11. Persistence. The use of files, streams and serialization for storing object model data

VISUAL BASIC 2005 EXPRESS: NOW PLAYING

1. We insert elements inside (CompoBox) tool through Items property ( ) 2. ComboBox tool use to choose just one item from the list ( )

Visual Studio.NET for AutoCAD Programmers

Year 12 : Visual Basic Tutorial.

To get started with Visual Basic 2005, I recommend that you jump right in

VB FUNCTIONS AND OPERATORS

Applicant Tutorial Foundant Grant Lifecycle Manager

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 11/16/2010

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

超音波モータ制御プログラムの作成 (v1.2.1)

Visual Basic: Opdracht Structuur

ADO.NET for Beginners

Lab 6: Making a program persistent

Building Database Applications with ADO.NET

Visual Basic 2008 The programming part

This PDF was generated in real-time using DynamicPDF; Generator for.net.

TRAINING GUIDE FOR OPC SYSTEMS.NET. Simple steps to successful development and deployment. Step by Step Guide

Module 9: Validating User Input

UNIT 1: PROGRAMMING ENVIRONMENT

Upgrading Applications

Starting Visual Studio 2005

Transcription:

Form Adapter Example DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19

Form_Adapter.doc DRAFT page 1 Table of Contents Creating Form_Adapter.vb... 2 Adding the Code... 2 Fixing Errors... 4 Watching myconnection... 4 Running Form_Adapter... 6

Form_Adapter.doc DRAFT page 2 Creating Form_Adapter.vb Open Visual Studio, click File, and select New Project. Visual Studio will prompt you to select a type of project. You ll want to choose Windows Form and name it Form_Adapter. Under properties, change your form name to Form_Adapter. You should begin with a form similar in appearance to the one below. Adding the Code Next, you ll want to enter the code for this project. To do so, double click the form you created, which will take you to the Code Explorer screen. You ll notice the following code already there.

Form_Adapter.doc DRAFT page 3 Take note of this code, because you ll want to integrate yours into the existing framework. I ve highlighted the existing code for your convenience. Type the following into the Code Explorer, making sure you reproduce it character for character. Again, the highlighted code should already appear on the screen. Imports System.Data.OleDb Public Class Form_Adapter Dim myconnection_string As String Dim live_wire_oledb_connection As OleDbConnection Dim live_wire_oledb_adapter As OleDbDataAdapter Private Sub form_adapter_load(byval sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sql As String live_wire_oledb_connection = open_connection_to_access_database() sql = "SELECT * FROM CONTACTS" live_wire_oledb_adapter = New OleDbDataAdapter(sql, live_wire_oledb_connection) End Sub By typing the above code, you ve imported System.Data.OleDb, declared variables, and ran a private sub procedure. Next, you ll want to enter the first of two functions into the Code Explorer, directly following the End Sub line. Function open_connection_to_access_database() Dim myconnection As OleDbConnection myconnection_string = make_connection_string() myconnection = New OleDbConnection(myConnection_string) Return myconnection End Function

Form_Adapter.doc DRAFT page 4 Finally, add the following code, which will complete your program. Again, be sure to type everything character for character, and not to retype any highlighted code. Function make_connection_string() Dim connection_string As String Dim provider As String Dim data_source As String Dim security As String provider = "Provider=Microsoft.jet.oledb.4.0;" data_source = "Data Source=c:\slm.mdb;" security = "Persist Security Info=false;" connection_string = provider & data_source & security Return connection_string End Function End Class Fixing Errors If after typing this code you encounter any errors that prevent you from debugging, compare each line of code you wrote to those above, and fix any discrepancies. Watching myconnection After entering the code, take the time to use F8 to step through the individual lines of code. Select the myconnection variable, right click it, and select Add Watch.

Form_Adapter.doc DRAFT page 5 Keep using F8 to step through the individual processes, and note how the myconnection variable value goes from undeclared to nothing to eventually {System.Data.OleDb.OleDbConnection}. Once you ve reached this point, expand myconnection in the Watch window by clicking the plus sign to its right. You should see a screen similar the following.

Form_Adapter.doc DRAFT page 6 Running Form_Adapter Press F8 a few more times, and you should see a fully loaded form meaning that our program, Form_Adapter, is running! Your program works!