Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
Bing
BizTalk
Book Excerpts
Build and Deploy
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
Internet Explorer 8.0
Interviews
iPhone
Iron Ruby
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
Network
NHibernate
Object Oriented Development
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Product News
Product Reviews
Project Management
Python
Q&A
Rails
Rake
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



Virtual Brown Bag Lunches


 


Free Webinar

Reader rating:
Click here to read 3 comments about this article.
Article source: CoDe (2007 - Vol. 4 - Issue 1 - Sedna: Beyond Visual FoxPro 9 )


Article Pages:  1  2 3 4 5 - Next >


The Baker’s Dozen: 13 Productivity Tips for Moving from VFP to .NET

When Visual FoxPro developers take the plunge to learn .NET, the most common reaction is, “I could do such-and-such, this-and-that in VFP-how can I do it in .NET?” This special edition of The Baker’s Dozen will offer solutions for many of the typical challenges that VFP developers face when tackling .NET. I’ll start by covering .NET solution and project structures and an overview of the .NET Framework, and I’ll spend time showing how to use .NET reflection to do some of the things that VFP developers could accomplish with macro-expansion. Then I’ll cover different .NET features such as Generics, ASP.NET 2.0, and I’ll show how to create a reusable data access component. Finally, I’ll build the architecture for a set of reusable data maintenance classes in .NET.

Beginning with the End in Mind

I have the same goal in writing this article that I have in my Baker’s Dozen articles in CoDe Magazine: I’ll write a set of how-to tips that I would love to have read when I set out to learn a new technology or feature. I started developing software in 1987 and can honestly say that the transition from VFP to .NET was the most challenging (and also rewarding) endeavor of my career.

"
There is no one simple answer to the question of a .NET equivalent to VFP’s macro-but fortunately, the .NET Framework has a namespace called System.Reflection that provides developers with functions for run-time discovery.
"

In this article, I’ll cover the following:

  • Understanding .NET projects, solutions, and assemblies, and a quick language primer
  • A quick tour through the common .NET Framework classes
  • How to use reflection in place of the VFP macro
  • Building a .NET data access class
  • .NET Generics and anonymous methods in C#
  • Some powerful features in ASP.NET 2.0 and AJAX
  • The Baker’s Dozen Spotlight: building a reusable data maintenance form class (this covers the next four tips)
  • Subclassing Windows Forms controls and implementing reusable data binding
  • Building a data maintenance criteria container (UserControl)
  • Building a data maintenance results container (UserControl)
  • Building a data maintenance entry/edit container (UserControl)
  • Working with data in DataSets using ADO.NET

At the end of this article, I’ll include a list of books, articles, and other resources that I recommend for further research.

Watching My Language

I wrote the example code in this article in C#. I prefer C# because I previously wrote C and C++. In most instances, developers can take the code in this article and port it to Visual Basic. However, Tip 5 contains code that uses anonymous methods, a new C# language feature with that doesn’t have a Visual Basic equivalent though it will be available in the next version. For that situation I’ll provide a workaround that works today.

Less Talk, More Code

I set a goal for this article to be short on talk and long on code. When I began the .NET learning curve, I got the most value out of books and articles that contained meaningful code samples. So for each tip, as much as possible, I’ll minimize the yakking and focus on the hacking. (There was a time when hacker meant something complimentary!)

Tip 1: Understanding .NET Solutions, Projects, Assemblies, and References

Let’s start by looking at the solution and project structure in Visual Studio 2005 for an actual .NET application. Figure 1 shows the complete solution for a demo .NET database application. A .NET solution is a collection of .NET projects. The .NET solution in Figure 1 consists of the following:

Click for a larger version of this image.

Figure 1: Solution structure.

  • Two solution folders, one for a framework of reusable classes (Common Ground Framework), and one for an actual demo application (Construction Demo).
  • Subfolders to further categorize projects within a main folder.
  • Under each solution you’ll see a series of .NET projects. Each project contains one or more related class files that compile to a single separate DLL. For instance, the project CGS.DataAccess contains a class file for basic data access functionality. The project compiles to CGS.DataAccess.DLL and can be used from other .NET projects.
  • In addition, the project ConstructionDemo.Client.Winforms (in the folder structure Construction Demo…Client…Winforms) appears in bold, because I’ve defined it as the startup project. When I build this project, Visual Studio 2005 will create an executable file.

Many classes will refer to functions in base libraries, and will also inherit from previous classes in other .NET projects. In these situations, it is necessary to set add a reference to parent libraries. You can right-click on a project and select Add Reference from the short-cut menu (Figure 2).

Click for a larger version of this image.

Figure 2: Solution project options.

In many instances you need to tell Visual Studio 2005 that some projects depend on others. You can also use the same short-cut menu (Figure 2) to establish project dependencies. For instance, project X may depend on projects A, B, and C. Figure 3 allows you to set the dependencies for any project in the solution.

Click for a larger version of this image.

Figure 3: Project dependencies.

&

By: Kevin S Goff

Kevin S. Goff, a Microsoft MVP award recipient for 2007, is the founder and principal consultant of Common Ground Solutions, a consulting group that provides custom Web and desktop software solutions in .NET, VFP, SQL Server, and Crystal Reports. Kevin is the author of Pro VS 2005 Reporting using SQL Server and Crystal Reports, published by Apress. Kevin has been building software applications since 1988. He has received several awards from the U.S. Department of Agriculture for systems automation. He has also received special citations from Fortune 500 Companies for solutions that yielded six-figure returns on investment. He has worked in such industries as insurance, accounting, public health, real estate, publishing, advertising, manufacturing, finance, consumer packaged goods, and trade promotion. In addition, Kevin provides many forms of custom training. Contact Kevin at kgoff@commongroundsolutions.net

kgoff@commongroundsolutions.net

Fast Facts

This article contains a number of .NET/C# code samples to show VFP developers how to do common tasks in .NET.



Article Pages:  1  2 3 4 5 - Next Page: 'Tip 2: A Whirlwind Tour through the common .NET Framework Classes' >>

Page 1: The Baker’s Dozen: 13 Productivity Tips for Moving from VFP to .NET
Page 2: Tip 2: A Whirlwind Tour through the common .NET Framework Classes
Page 3: Tip 4: Building a Data Access Class
Page 4: Tip 6: Cool Features in ASP.NET 2.0 and AJAX
Page 5: Tip 8: Building a Base Data Maintenance Form

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.3 out of 5

65 people have rated this article.

      Hacker Halted

 

Devscovery