- Notifications
You must be signed in to change notification settings - Fork1
Salmon King Seafood (SKS) Reference App to show some of the features of the Visual Basic Upgrade Companion tool from Mobilize.NET to migrate code from VB6 to .NET.
GAPVelocityAI/SKSWinForms
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Salmon King Seafood (SKS) is a reference App create to show some of the migration capabilities of theVisual Basic Upgrade CompanionVBUC fromMobilize.Net
This repo contanins the migratedSKS VB6 Version
If you want to build this project on your development machine, just check that you match the following requirements:
- SQLite3 ODBC Driver (download sqliteodbc.exe and sqliteodbc_w64.exe)
- .Net Framework 4.7
You can clone the repository to your machine. From the command line just run:
git clone https://github.com/MobilizeNet/SKSWinForms.gitOr you can download the code by clicking on Download ZIP
NOTE: if you download the code remember to unblock your files. When you download certain files Windows will block then forsecurity and you might get an error like
To fix this problem:Open the file explorer. Navigate to project/solution directorySearch for *.resx. --> You will get list of resx filesRight click the resx file, open the properties and check the option 'Unblock'Repeat #3 for each resx file.Reload the project.
Once you have downloaded the code look for SKS.sln. And open that file.When the solution is open the first thing you need to do is restore packages.One easy way to do is right click on your solution node.
Select theManage Nuget Packages for Solution... and select that option. From there you can make sure that all nugets are restored.
Once all the nugets have been restore, just rebuild and run.
Below you can see some of the migrated screens
ConvertsADODB to ADO.Net by using the System.Data.Common libraries and some helpers.
Remarks
- This option converts
ADODBto ADO.NET by using helper classes but with a very high automation level.- If the VB6 code is using data binding to grids it is also recommended to convert all data grids to .Net components.
This solution uses a set of helper objects to provide equivalent behavior in .Net and to encapsulate the ADO.Net machinery required in order to handle a set of data, more specifically for the RecordSet object, which is very powerful and flexible in VB6 and does not have a direct equivalence in .Net. The approach reduces the manual changes effort to achieve functional equivalence.
The usage ofSystem.Data.Common libraries provides the application with the ability to interact with different Database Manager Systems (e.g. SQL Server, Oracle, MS Access, etc) through its ADO.Net 2.0 compliant providers with just a minimal configuration effort and proper dialect changes.
Deployment Note
This feature if needed can be configured using a .Net configuration file containing specific sections. SeeExample
| Class | Maps To |
|---|---|
| ADODB.RecordSet | UpgradeHelpers.DB.ADO.ADORecordSetHelper |
| ADODB.Command | System.Data.Common.DbCommand |
| ADODB.CommandTypeEnum | System.Data.CommandType |
| ADODB.Connection | System.Data.Common.DbConnection |
| ADODB.DataTypeEnum | System.Data.DbType |
| ADODB.Field | System.Data.DataColumn |
| ADODB.Fields | System.Data.DataColumnCollection |
| ADODB.IsolationLevelEnum | System.Data.IsolationLevel |
| ADODB.ObjectStateEnum | System.Data.ConnectionState |
| ADODB.Parameter | System.Data.Common.DbParameter |
| ADODB.ParameterDirectionEnum | System.Data.ParameterDirection |
| ADODB.Parameters | System.Data.Common.DbParameterCollection |
| ADODB.Stream | System.IO.StreamWriter |
| ADODB.LockTypeEnum | UpgradeHelpers.DB.ADO.LockTypeEnum |
| ADODB.CursorLocationEnum | UpgradeHelpers.DB.ADO.CursorLocationEnum |
| ADODB.AffectEnum | UpgradeHelpers.DB.ADO.AffectEnum |
| ADODB.EventStatusEnum | UpgradeHelpers.DB.ADO.Events.EventStatusEnum |
| ADODB.EventReasonEnum | UpgradeHelpers.DB.ADO.Events.EventReasonEnum |
| ADODB.PositionEnum | UpgradeHelpers.DB.ADO.PositionEnum |
| MSAdodcLib.Adodc | UpgradeHelpers.DB.ADO.ADODataControlHelper |
| MSAdodcLib.EOFActionEnum | UpgradeHelpers.DB.Controls.EOFActionEnum |
| MSAdodcLib.BOFActionEnum | UpgradeHelpers.DB.Controls.BOFActionEnum |
VB6
DimconConnectionAsNewADODB.ConnectionDimcmdCommandAsNewADODB.CommandDimrstRecordSetAsNewADODB.RecordsetconConnection.OpencmdCommand.CommandText="SELECT * FROM TestTable;"...rstRecordSet.OpenIfrstRecordSet.EOF=FalseThenMsgBoxrstRecordSet.Fields(0).Name&"="&rstRecordSet.Fields(0)ElseMsgBox"No records were returned using the query "&cmdCommand.CommandTextEndIf
C#
usingUpgradeHelpers.DB;...DbConnectionconConnection=AdoFactoryManager.GetFactory().CreateConnection();DbCommandcmdCommand=AdoFactoryManager.GetFactory().CreateCommand();ADORecordSetHelperrstRecordSet=newADORecordSetHelper("");conConnection.Open();...cmdCommand.CommandText="SELECT * FROM TestTable;";...rstRecordSet.Open();if(!rstRecordSet.EOF){MessageBox.Show(Convert.ToString(rstRecordSet[0]),Application.ProductName);}else{MessageBox.Show("No records were returned using the query "+cmdCommand.CommandText,Application.ProductName);}
Maps Microsoft'sMSFlexGridLib to a helper class that extends theSystem.Windows.Forms.DataGridView component
| Class | Maps To |
|---|---|
| MSFlexGridLib.MSFlexGrid | UpgradeHelpers.Gui.DataGridViewFlex |
VB6
PrivateSubForm_Load()DimctlAsMSFlexGridSetctl=MSFlexGrid1ctl.ScrollBars=flexScrollBarBothctl.GridLines=flexGridNoneEndSub
privatevoidForm1_Load(ObjecteventSender,EventArgseventArgs){UpgradeHelpers.Gui.DataGridViewFlexctl;ctl=newUpgradeHelpers.Gui.DataGridViewFlex();ctl.ScrollBars=ScrollBars.Both;ctl.CellBorderStyle=DataGridViewCellBorderStyle.None;}
Convert Collection type toSystem.Collections.Specialized.OrderedDictionary
| Class | Maps To |
|---|---|
| vba.Collection | System.Collections.Specialized.OrderedDictionary |
Converts Microsoft'sMSComctLib classes toSystem.Windows.Forms.
Remarks:
- By using this option the converted application will not have any >reference to the COM Component.
| Class | Maps To |
|---|---|
| MSComctlLib StatusBar | System.Windows.Forms.StatusStrip |
| MSComctlLibToolbar | System.Windows.Forms.ToolStrip |
| MSComctlLibImageList | System.Windows.Forms.ImageList |
| MSComctlLibTabStrip | System.Windows.Forms.TabControl |
| MSComctlLibTreeView | System.Windows.Forms.TreeView |
| MSComctlLibImageCombo | System.Windows.Forms.ComboBox |
| MSComctlLibListView | System.Windows.Forms.ListView |
| MSComctLib.ProgressBar | System.Windows.Forms.ProgressBar |
VB6
BeginVB.FormForm1...BeginMSComctlLib.ImageComboImageCombo1...EndBeginMSComctlLib.SliderSlider1...EndBeginMSComctlLib.ImageListImageList1...EndBeginMSComctlLib.ListViewListView1...EndBeginMSComctlLib.TreeViewTreeView1...EndBeginMSComctlLib.ProgressBarProgressBar1...EndBeginMSComctlLib.StatusBarStatusBar1...EndBeginMSComctlLib.TabStripTabStrip1...EndBeginMSComctlLib.ToolbarToolbar1...End...
C#
partialclassForm1{ ...publicSystem.Windows.Forms.MaskedTextBoxMaskEdBox1;publicSystem.Windows.Forms.ComboBoxImageCombo1;publicSystem.Windows.Forms.TrackBarSlider1;publicSystem.Windows.Forms.ImageListImageList1;publicSystem.Windows.Forms.ListViewListView1;publicSystem.Windows.Forms.TreeViewTreeView1;publicSystem.Windows.Forms.ProgressBarProgressBar1;privateSystem.Windows.Forms.ToolStripStatusLabel_StatusBar1_Panel1;publicSystem.Windows.Forms.StatusStripStatusBar1;privateSystem.Windows.Forms.TabPage_TabStrip1_Tab1;publicSystem.Windows.Forms.TabControl.TabPageCollectionTabStrip1_Tabs;publicSystem.Windows.Forms.TabControlTabStrip1;publicSystem.Windows.Forms.ToolStripToolbar1; ...privatevoidInitializeComponent(){ ...this.ImageCombo1=newSystem.Windows.Forms.ComboBox();this.Slider1=newSystem.Windows.Forms.TrackBar();this.ImageList1=newSystem.Windows.Forms.ImageList();this.ListView1=newSystem.Windows.Forms.ListView();this.TreeView1=newSystem.Windows.Forms.TreeView();this.ProgressBar1=newSystem.Windows.Forms.ProgressBar();this.StatusBar1=newSystem.Windows.Forms.StatusStrip();this._StatusBar1_Panel1=newSystem.Windows.Forms.ToolStripStatusLabel();this.TabStrip1=newSystem.Windows.Forms.TabControl();this.TabStrip1_Tabs=newSystem.Windows.Forms.TabControl.TabPageCollection(TabStrip1);this._TabStrip1_Tab1=newSystem.Windows.Forms.TabPage();this.Toolbar1=newSystem.Windows.Forms.ToolStrip();}
About
Salmon King Seafood (SKS) Reference App to show some of the features of the Visual Basic Upgrade Companion tool from Mobilize.NET to migrate code from VB6 to .NET.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.


