Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

I need help converting VB6 code to .Net

Hi All,

Please help with converting the attached vb6 code to .net.

Thanks in advance,

Jerry
DefInt A-Z
Option Explicit
 
Global PPath$                                   'program path
 
Global CancelFlag As Boolean
Global Const CCSetup_Reclen = 99
 
'Credit Card company setup
Type CCcompanyType
    Company As String * 2
    Path As String * 30
    TID As String * 32
End Type
Global CCcompany As CCcompanyType
 
'Debit Card file structure
Type DCtype
    Company As Integer
    TID As String * 32
    Phone1 As String * 20
    Phone2 As String * 20
    'fdf 3/1/2001 added..begin
    WorkingKey As String * 16
    Processor As String * 4
    Default As String * 1
    MasterKey As String * 1
    KeyManagement As String * 1
    SerialNumber As String * 16
    Blank As String * 15
    'fdf 3/1/2001 added..end
'    Blank As String * 54
End Type
Global DC As DCtype
 
'Check Services company setup
Type CHKcompanyType
    Company As String * 2
    SiteID As String * 32
    Service As String * 2
    Blank As String * 28
End Type
Global CHKcompany As CHKcompanyType
 
'fdf 2/19/2001 added..begin
'Debit Card file structure
Type GCtype
    'Company As Integer
    Company As String * 1
    TID As String * 32
    Phone1 As String * 20
    Phone2 As String * 20
    Blank As String * 54
End Type
Global GC As GCtype
'fdf 2/19/2001 added..end
 
'general program constants
Global CR$
Global LF$
 
Global Action As String

Open in new window

0
JDL129
Asked:
JDL129
  • 3
  • 3
  • 2
3 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
DefInt does not exist anymore.

Do you really have to use Fixed-Lenght strings? .Net does not really support them.
0
 
DhaestCommented:
Perhaps it's easier to tell what you exactly want.
As far as I see it, you just can create a class (a small very easy example below)
Public Class CCcompanyType
    Public Company As String
    Public Path As String
    Public TID As String
 
End Class

Open in new window

0
 
JDL129Author Commented:
Thank you both for the responses!!
Dhaest!!
This is a class from vb6 that is used to process information to send to credit card companies.  I am a VERY newbie in .Net but am making some headway learning a new language and need this snippet changed to run in .Net.

So you can just replace 'Type' with 'Class'?  With I tried to run the in .Net the error said that 'Type' had been replaced with 'Structure'.

Can I use the following?
Public Company As String * 2

How would you dimension the 'Global's'

Thanks Again,

Jerry



0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
DhaestCommented:
>> Public Company As String * 2

As explained by emoreau, .net doesn't really support it

How to declare global Variables in VB.NET and C#?
http://smartypeeps.blogspot.com/2006/06/how-to-declare-global-variables-in.html

Structures
http://www.startvbdotnet.com/oop/structure.aspx

I wouldn't recommand just trying to translate your program from vb6 into vb.net, but just reprogramme the complete application
0
 
JDL129Author Commented:
Dhaest!!

Any ideas how to handle the * values?

Thanks,

Jerry
PS:  I am in the middle of reprogramming
0
 
DhaestCommented:
>> Any ideas how to handle the * values?

What do you mean ? Do you mean such a declaration (Phone1 As String * 20).
As already mentioned. .NET doesn't support it
0
 
Éric MoreauSenior .Net ConsultantCommented:
If you really need fixed length, you can use the VBFixedString attributes as shown in http://social.msdn.microsoft.com/Forums/en-US/vbinterop/thread/e9b0e85b-2f3a-4be0-b65d-f7c6de89d7d7/
0
 
JDL129Author Commented:
All,

Thanks for your help!!

Both of you had good stuff to offer so I'll split the points.

Thanks again,
Jerry
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now