session 4 from access forms to windows forms.net adam cogan database architect ssw.com.au
Post on 19-Dec-2015
224 views
TRANSCRIPT
![Page 1: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/1.jpg)
Session 4Session 4From Access Forms to From Access Forms to Windows Forms .NET Windows Forms .NET
Adam CoganDatabase Architectssw.com.au
![Page 2: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/2.jpg)
ToToFromFrom
![Page 3: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/3.jpg)
OverviewOverview
Access 97 Access 97 toto
Access 2003Access 2003
AccessAccesstoto
SQL ServerSQL Server
AccessAccesstoto
ReportingReportingServicesServices
AccessAccesstoto
WindowsWindowsForms .NETForms .NET
11 22 33 44
![Page 4: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/4.jpg)
AgendaAgenda• Current Problems• What’s New in .NET• Lab: Migrating from Access
Forms to Windows Forms .NET
Breezers Drink Receipt From Outback Oz
![Page 5: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/5.jpg)
AssumptionsAssumptions
• Backend in SQL Server 2000• Using Enterprise Manager for data
management• Access forms front-end• Reports using Reporting Services• Some VBA knowledge
![Page 6: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/6.jpg)
![Page 7: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/7.jpg)
![Page 8: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/8.jpg)
![Page 9: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/9.jpg)
![Page 10: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/10.jpg)
Session Prerequisites (Current Problems)Session Prerequisites (Current Problems)
1. “Our application stopped working on Mary’s machine when we installed the new version of Office”
2. “Our Access database got corrupted and we can’t open it”
3. “Our Access forms run too slowly - we want a small, fast EXE”
4. “Can we stop the continual polling of SQL Server so we can scale this application?”
5. “We want to integrate with other systems”
![Page 11: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/11.jpg)
Enter .NETEnter .NET
• No need for Access runtime or Office for end-user (1)
• Produce an EXE which doesn’t get corrupted like an MDB (2)
• The EXE is small and runs fast (3)• Only explicit updates to database (4)• Web Service Support are built in (use
an open XML-based architecture) (5)
![Page 12: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/12.jpg)
Problems with Bound Access Problems with Bound Access FormsForms
Advantage – Database Connections are Controllable
In Access• Forms perform database queries in the
background• Cannot be controlledIn .NET• Full control over database connections and
queries• Improved performance and scalability
Not as smooth a ride
![Page 13: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/13.jpg)
Problems with Bound Access Problems with Bound Access FormsForms
Advantage – Database Connections are Controllable
In Access
In .NET
![Page 14: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/14.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – A Shallow Learning Curve for Access Developers (1 of 2)
![Page 15: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/15.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – A Shallow Learning Curve for Access Developers (2 of 2)
![Page 16: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/16.jpg)
Northwind .NETNorthwind .NET
![Page 17: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/17.jpg)
Differences In Form DesignDifferences In Form Design
New Feature – Anchoring Controls
![Page 18: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/18.jpg)
Differences In Form DesignDifferences In Form Design
New Feature – Docking Controls
![Page 19: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/19.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – Powerful New Controls (1 of 2)
![Page 20: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/20.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – Powerful New Controls (2 of 2)
![Page 21: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/21.jpg)
Data FormsData Forms
In Access1. Get Data – Make Queries
![Page 22: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/22.jpg)
Data FormsData Forms
In Access2. Bind – Set the One RecordSource
![Page 23: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/23.jpg)
Data FormsData FormsIn Access
3. Bind – Set the ControlSource for all bound controls
![Page 24: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/24.jpg)
Data FormsData FormsIn .NET
1. Get Data – Create Data Components (DataSets and DataAdapters)
![Page 25: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/25.jpg)
Data FormsData FormsIn .NET
2. Bind – Set the Many Referenced DataSets
![Page 26: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/26.jpg)
Data FormsData FormsIn .NET
3. Bind – Set the DataBindings for all bound controls
![Page 27: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/27.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Database Updates Are Not Done Automatically
In Access1. Changes made on forms are
automatically saved
In .NET:1. Add a save button2. Call DataAdapter.Update(DataSet) in
the OnClick event
![Page 28: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/28.jpg)
Differences in Application DesignDifferences in Application Design
Advantage – All .NET Solution Items are Described in Plain Text
In Access• Everything is in the MDB• If damaged, everything stops workingIn .NET• All solution items are in plain text• Forms described in XML• Low chance of corruption• Lightweight
![Page 29: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/29.jpg)
Differences In Form DesignDifferences In Form Design
Difference – Data Views
Access Visual Studio .NET
Design Supported
FormCompile and Run Application
Datasheet Not supported
![Page 30: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/30.jpg)
NavigationNavigation
Private Sub previousRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles previousRecord.Click ' Check that the user isn't on the first record. If Not Me._ordersManager.Position = 0 Then _movingRecords = True Me._ordersManager.Position -= 1 _movingRecords = False End If End Sub
Private Sub nextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nextRecord.Click ' Check that the user isn't on the last record. If Not Me._ordersManager.Position = Me._ordersManager.Count - 1 Then _movingRecords = True Me._ordersManager.Position += 1 _movingRecords = False End If End Sub
![Page 31: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/31.jpg)
Add / Edit Line ItemsAdd / Edit Line Items
Private Sub editItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editItem.Click ' Check that there is a row to edit. If Not BindingContext(ordersList, "Orders.OrdersOrder_Details").Position = -1 Then Dim cm As CurrencyManager = CType(BindingContext(ordersList, "Orders.OrdersOrder_Details"), CurrencyManager)
' Get the current row. Dim orderItem As OrdersDataSet.Order_DetailsRow = CType(CType(cm.Current, DataRowView).Row, OrdersDataSet.Order_DetailsRow)
' Pass the current row to the Order Details form. Dim orderDetailsForm As New OrderDetailsPopupForm(orderItem)
' Show the Order Details form and return the result. Dim result As DialogResult = orderDetailsForm.ShowDialog() ' Check if the user clicked "OK".
If result = DialogResult.OK Then CalculateTotals() End If End If End Sub
![Page 32: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/32.jpg)
Save DataSave Data
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click Me._ordersManager.EndCurrentEdit() ' Check if changes were made If ordersList.HasChanges Then ' Update the Orders table _ordersDA.Adapter.Update(ordersList) ' Update the Order Details table _orderDetailsDA.Adapter.Update(ordersList) End If End Sub
![Page 33: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/33.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Multiple Columns Not Supported in Some Controls
• Use .NET ListView instead of Access Listbox• Some programming required for multi-
column ComboBox
![Page 34: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/34.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Multiple Columns Not Supported in Some Controls
![Page 35: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/35.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – The Datasheet View Is Harder to Implement
In Access• View – DatasheetIn .NET:
• Use DataGrid control• Manually bind to database• Hard to implement advanced controls (ComboBox
etc.)
![Page 36: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/36.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Continuous Forms Are Harder to Implement (1 of 4)
In Access• Form Property: Default View = Continuous
Forms In .NET• Not supported in .NET• 2 options
– Tiled user controls– Summary/Detail
![Page 37: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/37.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Continuous Forms Are Harder to Implement (2 of 4)
• Tiled user controls
![Page 38: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/38.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Continuous Forms Are Harder to Implement (3 of 4)
• Split into summary/detail for complex subforms
![Page 39: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/39.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Continuous Forms Are Harder to Implement (4 of 4)
• Split into summary with popup window
![Page 40: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/40.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Subforms are Easier to Use than User Controls (1 of 2)
In Access1. Create parent and sub forms2. Add subform/subreport to parent3. Set linkages between parent/subform
![Page 41: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/41.jpg)
Differences In Form DesignDifferences In Form DesignDisadvantage – Subforms are Easier to Use than User Controls (2
of 2)In .NET1. Create Orders form (parent)2. Create user control for Orders Subform form3. Add property to user control to link parent and subform
(code)4. Update the Orders Subform (user control) when the parent
record changes (code)5. Add the Orders Subform (user control) to the Orders form6. Bind the Orders form to the Orders Subform (user control)
Note: We take a different approach with our example (popup window)
![Page 42: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/42.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – Form Inheritance1. Add any common form controls and
logic into a base form2. Create new instances of (“inherit”)
the parent form to ensure consistency
3. Make any required changes to logic and controls on child forms
![Page 43: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/43.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – Use Windows XP Styles• Easy to implement in .NET
![Page 44: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/44.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Read-Only Textboxes are Grayed Out
In Access• Set Locked = YesIn .NET• Set ReadOnly = True• Have to explicitly set the background colour
![Page 45: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/45.jpg)
Differences In Form DesignDifferences In Form Design
Disadvantage – Combo Boxes Cannot Be Locked
In Access• Set Locked = YesIn .NET• No automatic way• Capture the SelectedIndexChanged
event and reset the value
![Page 46: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/46.jpg)
Differences In Form DesignDifferences In Form Design
Advantage – Applications Are Stored As Binary Executables
In Access• Use compact and repair• Manually compile as MDEIn .NET• Application automatically compiled on
run• Runs efficiently because it is in binary
![Page 47: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/47.jpg)
Differences in Application DesignDifferences in Application Design
Advantage – Application Deployment is Easier
In Access:• License for Office Developer Edition
(for runtime), or• Office installed on target machineIn .NET you only need the free .NET
Framework
![Page 48: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/48.jpg)
Differences in Application DesignDifferences in Application Design
Advantage – .NET Versions Can Be Run Side-by-Side
In Access:• Upgrading Office can cause issues (as we have
seen)• Can have multiple versions of Office installed –
however MDB associations don’t know enoughIn .NET:• Framework versions can run side-by-side• Apps using 1.0 continue to work alongside 1.1
![Page 49: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/49.jpg)
Advantage – Extending Your Forms to Mobile Devices
?.NET Web Service
Business and Data Access Logic
Differences in Application DesignDifferences in Application Design
![Page 50: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/50.jpg)
Differences in Application DesignDifferences in Application Design
Difference – Security Model Integrates with Windows
In Access• Maintain two sets of security for forms
(Access) and backend (SQL)
![Page 51: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/51.jpg)
Differences in Application DesignDifferences in Application Design
Difference – Security Model Integrates with Windows
In .NET• Use Windows Integrated security• Based on Active Directory – one model
for forms and SQL Server• Check user’s role in code (using
System.Security.Principal namespace)
![Page 52: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/52.jpg)
Differences in Application DesignDifferences in Application Design
Disadvantage – No Wizard-Based Security
In Access:• Use the User-level Security Wizard to
automatically set object permissionsIn .NET:• Form permissions must be defined in
code
![Page 53: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/53.jpg)
Differences in ProgrammingDifferences in Programming
Difference – VBA replaced by VB.NETIn Access you use• VBA• .DLLsIn .NET• VB.NET, C#, J# etc.• Can use components written in other
languages
![Page 54: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/54.jpg)
Differences in ProgrammingDifferences in ProgrammingAdvantage – Improved Language Features• Structured exception handling• Form and code inheritance• XML and XSL functionality for web services• Simple API wrappers – less API calls
– accessing printers– file dialog boxes
• Improved internationalisation and regional customisation
• Create and deploy DLLs, user controls and web services in .NET
![Page 55: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/55.jpg)
Differences in ProgrammingDifferences in Programming
Difference – Macros replaced by VB .NETIn Access you use • the visual macro designerIn .NET• you must rewrite as codeTip: Use the Macro to VBA converter to
simplify rewriting
![Page 56: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/56.jpg)
Differences in ProgrammingDifferences in Programming
Difference – Responding to Form Events• .NET – new “Handles” keyword• One method can handle multiple
events
• All Access form events can be handled
Private Sub OpenCustomer (…) Handles btnOK.Click, cboCustomers.DoubleClick
…
End Sub
![Page 57: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/57.jpg)
Differences in ProgrammingDifferences in Programming
Advantage – Improved Development Environment (1 of 3)
• Improved Intellisense
![Page 58: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/58.jpg)
Differences in ProgrammingDifferences in Programming
Advantage – Improved Development Environment (2 of 3)
• Improved design-time debugging
![Page 59: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/59.jpg)
Differences in ProgrammingDifferences in Programming
Advantage – Improved Development Environment (3 of 3)
• Visually build database objects
![Page 60: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/60.jpg)
Differences in ProgrammingDifferences in Programming
Advantage – Use Unit Testing Tools to Check Your Code
• Cannot test code in Access• .NET supports testing frameworks eg. nUnit
![Page 61: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/61.jpg)
Differences in ProgrammingDifferences in Programming
Difference – Autoexec Macros vs. Startup Forms/Stubs
• In Access:– Startup form– Autoexec Macro
• In .NET:– Select form in project properties– Shared Sub Main()
![Page 62: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/62.jpg)
![Page 63: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/63.jpg)
SummarySummary• Current Problems
– New versions of Office cause applications to stop working
– Corrupt Access databases– Slow, large Access forms– Continual automatic polling of SQL Server,
limiting scalability– Hard to integrate with other systems
• What’s New in .NET• Lab: Migrating Access forms to .NET
![Page 64: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/64.jpg)
For More Information…For More Information…Microsoft Access: Upgrading and Migrating to SQL Server and .NET -
Course Resourceswww.ssw.com.au/ssw/Events/2004AccessToSQLServerAndNET/
Resources.aspxwww.microsoft.com/net
More courses in March – see www.microsoft.com/australia/events/
Tell your friends…
![Page 65: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/65.jpg)
![Page 66: Session 4 From Access Forms to Windows Forms.NET Adam Cogan Database Architect ssw.com.au](https://reader036.vdocuments.us/reader036/viewer/2022062515/56649d2b5503460f949ffc8b/html5/thumbnails/66.jpg)