Creating a Windows App version of a Web App

Creating a Windows App version of a Web App

Post by am9uZWZlc » Wed, 16 Aug 2006 16:24:01

I have a fully functional web app that I created in Visual Studio 2003.
I've even managed to translate it to a functional working 2005 version.

What are the best steps to creating a Windows based form version in a manner
that I can preserve a lot of the routines that I have written?

For example, I have a connection string in a WebConfig file that I refer to
in my Data Access Layer. I didn't use the graphical objects to do this, I
wrote most of the code and I would like to use this setup to take a lot of
business logic along for the ride:

For example, this routine fils a DataGrid on a Patient Screen with Lab results

Public Shared Function GetLabs (ByVal lMRN as integer) as dataset

Dim conMembers as SqlConnection = GetMembershipConnection()
Dim strLabsSQL as string

strLabSQL = "SELECT Proc_Name as [Lab Procedure], Comp_Name " _
& "as Component, Result " _
& "FROM tbl_Lab " _
& "WHERE MRN = @MRN " _
& "ORDER BY Result_Date desc"

Dim cmdGetLab as new sqlCommand(strLabSQL, conMembers)
cmdGetLab.CommandType = CommandType.text

Dim daLab as New SqlDataAdapter
daLab.SelectCommand = cmdGetLab
Return dsLab
End Function


I know there are new graphical ways to do this, but to save time, I would
like to use the types of tools I have already created, and not spend time
trying to learn about a more simple redesign using the new graphical tools.
Unless their is a simple way of illustrating how I could change the above
sample. The majority of my tools are setup this way. We are trying to
quickly migrate into a stand-alone desktop version which connects to a
subscribed replicated SQL Express version.

A replacement for my connection reference in WebConfig setup using the
AppConfig tool would be very valuable. Thanks!

Creating a Windows App version of a Web App

Post by Bob Powell » Wed, 16 Aug 2006 16:49:51

If you've been sensible about decoupling the data access layer from the
graphics you should be ok. There's not much yo can do to directly translate
the web app into a Windows Forms application but reuse of the DAL is
defeinitely possible.

Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting

Find great Windows Forms articles in Windows Forms Tips and Tricks

Answer those GDI+ questions with the GDI+ FAQ

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.