Solved

VB.NET code into VB6

Posted on 2004-03-25
25
640 Views
Last Modified: 2007-12-19
Hello, a friend of mine sent me some VB code to help me communicate with a server in VB (useing a dll called fdstalk.dll) unfortunetly the code is in VB.NET and i dont understand it at all :(

I was wondering would it be possable to convert the code to VB6 and (if possable) explain what each line does - Thanks in advanced - Nightma12 :)

p.s. if you need the dll i can upload it somewhere





Public Class FDSConnection
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents txtServerReturn As System.Windows.Forms.TextBox
    Friend WithEvents gpBottomControls As System.Windows.Forms.GroupBox
    Friend WithEvents cmbCommandSelect As System.Windows.Forms.ComboBox
    Friend WithEvents txtSendText As System.Windows.Forms.TextBox
    Friend WithEvents btSendText As System.Windows.Forms.Button
    Friend WithEvents tmrService As System.Windows.Forms.Timer
    Friend WithEvents tmrTimeOut As System.Windows.Forms.Timer
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FDSConnection))
        Me.txtServerReturn = New System.Windows.Forms.TextBox()
        Me.gpBottomControls = New System.Windows.Forms.GroupBox()
        Me.btSendText = New System.Windows.Forms.Button()
        Me.txtSendText = New System.Windows.Forms.TextBox()
        Me.cmbCommandSelect = New System.Windows.Forms.ComboBox()
        Me.tmrService = New System.Windows.Forms.Timer(Me.components)
        Me.tmrTimeOut = New System.Windows.Forms.Timer(Me.components)
        Me.gpBottomControls.SuspendLayout()
        Me.SuspendLayout()
        '
        'txtServerReturn
        '
        Me.txtServerReturn.AcceptsReturn = True
        Me.txtServerReturn.AcceptsTab = True
        Me.txtServerReturn.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.txtServerReturn.MaxLength = 0
        Me.txtServerReturn.Multiline = True
        Me.txtServerReturn.Name = "txtServerReturn"
        Me.txtServerReturn.ReadOnly = True
        Me.txtServerReturn.ScrollBars = System.Windows.Forms.ScrollBars.Both
        Me.txtServerReturn.Size = New System.Drawing.Size(592, 328)
        Me.txtServerReturn.TabIndex = 1
        Me.txtServerReturn.Text = ""
        Me.txtServerReturn.WordWrap = False
        '
        'gpBottomControls
        '
        Me.gpBottomControls.Controls.AddRange(New System.Windows.Forms.Control() {Me.btSendText, Me.txtSendText, Me.cmbCommandSelect})
        Me.gpBottomControls.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.gpBottomControls.Location = New System.Drawing.Point(0, 334)
        Me.gpBottomControls.Name = "gpBottomControls"
        Me.gpBottomControls.Size = New System.Drawing.Size(592, 64)
        Me.gpBottomControls.TabIndex = 1
        Me.gpBottomControls.TabStop = False
        Me.gpBottomControls.Text = "Control Interface"
        '
        'btSendText
        '
        Me.btSendText.Anchor = (System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)
        Me.btSendText.Location = New System.Drawing.Point(504, 24)
        Me.btSendText.Name = "btSendText"
        Me.btSendText.Size = New System.Drawing.Size(80, 20)
        Me.btSendText.TabIndex = 2
        Me.btSendText.Text = "Send"
        '
        'txtSendText
        '
        Me.txtSendText.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.txtSendText.Location = New System.Drawing.Point(120, 24)
        Me.txtSendText.Name = "txtSendText"
        Me.txtSendText.Size = New System.Drawing.Size(376, 20)
        Me.txtSendText.TabIndex = 1
        Me.txtSendText.Text = ""
        '
        'cmbCommandSelect
        '
        Me.cmbCommandSelect.Items.AddRange(New Object() {"Message"})
        Me.cmbCommandSelect.Location = New System.Drawing.Point(8, 24)
        Me.cmbCommandSelect.Name = "cmbCommandSelect"
        Me.cmbCommandSelect.Size = New System.Drawing.Size(112, 21)
        Me.cmbCommandSelect.TabIndex = 0
        '
        'tmrService
        '
        Me.tmrService.Interval = 200
        '
        'tmrTimeOut
        '
        Me.tmrTimeOut.Interval = 50000
        '
        'FDSConnection
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(592, 398)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtServerReturn, Me.gpBottomControls})
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "FDSConnection"
        Me.Text = "FDSConnection"
        Me.gpBottomControls.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region " Public Declarations "

#Region " Structures "

#End Region

#Region " Variables "

    Public MyFDS As MainGUI.FDS

#End Region

#Region " Functions "

    Public Sub Init()
        'initialize the FDS connection here, on errors display them in the log file etc...
        Me.Text = "FDS Connection [" & MyFDS.Name & "]"
        MyFDS.IP = CStr(System.Net.IPAddress.Parse(MyFDS.IP).Address)
        If Init(MyFDS.LocalPort, MyFDS.Pass) Then
            Me.LogText(MyFDS.Name & " Initilizing FDS Connection " & Now() & " to " & MyFDS.IP)
            IsInit = True
            Me.LogText("Loading Available Commands")
            Me.Send_Message(MyFDS.Pass, MyFDS.IP, MyFDS.RemotePort)
            Me.Send_Message("help", MyFDS.IP, MyFDS.RemotePort)
        Else
            Me.LogText("Could not initialize connection on port " & MyFDS.LocalPort)
            IsInit = False
        End If
        tmrService.Enabled = IsInit
    End Sub

#End Region

#End Region

#Region " Private Declarations "

#Region " Structures "

#End Region

#Region " Variables "
    Private IsInit As Boolean = False
    Private IsConnected As Boolean = False
    Private CommandsLoaded As Boolean = False
#End Region

#Region " Functions "

#Region " Api './FDSTalk.dll' "
    Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Int32, ByVal RemotePort As Int32)
    Private Declare Sub Service Lib "./FDSTalk.dll" ()
    Private Declare Sub Shutdown Lib "./FDSTalk.dll" ()
    Private Declare Sub Get_Response Lib "./FDSTalk.dll" (ByRef strResponse As String)
    Private Declare Function Init Lib "./FDSTalk.dll" (ByVal LocalPort As Int32, ByVal RemotePass As String) As Boolean
#End Region

    Private Sub LogText(ByVal strText As String)
        strText = strText.Replace(Chr(13), vbCrLf)
        strText = strText.Replace(Chr(10), vbCrLf)
        If strText.EndsWith(vbCrLf) Then
            strText = strText.Substring(0, Len(strText) - 1)
        End If
        Me.txtServerReturn.AppendText(strText & vbCrLf)
        Me.txtServerReturn.ScrollToCaret()
        If MyFDS.LogFile <> "" Then
            Dim i As Integer = FreeFile()
            FileOpen(i, MyFDS.LogFile, OpenMode.Append)
            Print(i, "[" & Format(Hour(Now), "0#") & ":" & Format(Minute(Now), "0#") & ":" & Format(Second(Now), "0#") & "] " & strText & vbCrLf)
            FileClose(i)
        End If
    End Sub

    Private Sub ProcessText(ByVal strText As String)
        '------ Available commands -------
        'admin_message, allow, ban, client_physics_optimization, edit_vehicle
        'extras, game_info, gameover, kick, message, net_update_rate, page
        'player_info, quit, quit_slave, restart, screen_uv_bias, set_bw_budget_out
        'toggle_sorting
        If InStr(strText, "------ Available commands -------") Then
            If CommandsLoaded Then
                Me.LogText("Command unrecognized by the server")
            Else
                'ok, load up the commands to the commandbox
                Me.cmbCommandSelect.Items.Clear()
                'remove the header            
                Dim tmp() As String = Split(strText, Chr(10), 2), i As Integer
                tmp(1) = tmp(1).Replace(Chr(10), ",")
                tmp = Split(tmp(1), ",")
                For i = 0 To UBound(tmp)
                    If tmp(i).Trim <> "" Then
                        Me.cmbCommandSelect.Items.Add(tmp(i).Trim)
                    End If
                Next i
                CommandsLoaded = True
                Me.LogText("FDS Connection Established " & Now())
            End If
        ElseIf InStr(strText, "For a list of available commands, use the " & Chr(34) & "help" & Chr(34) & " command !") Then
            'unknown command
            '"Enter Text Here" is not a command. To send a message, use "msg" and "amsg"
            'For a list of available commands, use the "help" command !
            Dim cmd As String = strText.Substring(1, InStr(strText.Substring(1), Chr(34)) - 1)
            If cmd <> Chr(255) & Chr(255) Then
                Me.LogText("Unknown Command " & Chr(34) & strText.Substring(1, InStr(strText.Substring(1), Chr(34)) - 1) & Chr(34))
            End If
        ElseIf InStr(strText, "Password accepted.") Then
            'login, is connected
            IsConnected = True
            Me.tmrTimeOut.Enabled = True
        ElseIf InStr(strText, "Goodbye!") Or InStr(strText, "** Connection timed out - Bye! **") Then
            'logoff, not connected
            Send_Message("bye", MyFDS.IP, MyFDS.RemotePort)
            IsConnected = False
            Me.tmrTimeOut.Enabled = False
            Me.LogText("Logged Off")
            Me.btSendText.Text = "Log On"
        Else
            Me.LogText(strText)
        End If
    End Sub

#End Region


#End Region

#Region " Events "

#Region " Form "

    Private Sub FDSConnection_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If IsInit Then
            Shutdown()
        End If
    End Sub

#End Region

#Region " Timers "

    Private Sub tmrService_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrService.Tick
        Service()
        Dim tmp As String
        Get_Response(tmp)
        If tmp <> "" Then
            ProcessText(tmp)
        End If
        Service()
    End Sub

    Private Sub tmrTimeOut_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTimeOut.Tick
        If IsConnected Then
            Send_Message(Chr(255) & Chr(255), MyFDS.IP, MyFDS.RemotePort)
        End If
    End Sub

#End Region

#Region " Buttons "

    Private Sub btSendText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSendText.Click
        If IsConnected Or Me.btSendText.Text = "Send" Then
            Send_Message(Trim(Me.cmbCommandSelect.Text & " " & Me.txtSendText.Text), MyFDS.IP, MyFDS.RemotePort)
            Me.txtSendText.Focus()
            SendKeys.Send("^+{HOME}")
        Else
            Me.Send_Message(MyFDS.Pass, MyFDS.IP, MyFDS.RemotePort)
            Me.LogText("Logged Back On")
            Me.btSendText.Text = "Send"
        End If
    End Sub

#End Region

#Region " Text Boxes "

    Private Sub txtSendText_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtSendText.KeyDown
        If e.KeyCode = Keys.Enter Then
            btSendText_Click(sender, Nothing)
        End If
    End Sub

#End Region

#End Region


End Class
0
Comment
Question by:Nightma12
  • 10
  • 9
  • 6
25 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10678663
In general, it is ALMOST impossible to 'down-grade' VB.NET code back to VB 6.  And in the case of this code, it would be IMPOSSIBLE to down-grade back to VB 6.

AW
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10679067
ok then if its impossable is it possable to create the code from scratch to use the dll?

http://www.all-out.co.uk/fdstalk.dll
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 100 total points
ID: 10679651
yes:
at the top of the code for your form, add (in the declarations section);

Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Long, ByVal RemotePort As Long)
    Private Declare Sub Service Lib "./FDSTalk.dll" ()
    Private Declare Sub Shutdown Lib "./FDSTalk.dll" ()
    Private Declare Sub Get_Response Lib "./FDSTalk.dll" (ByRef strResponse As String)
    Private Declare Function Init Lib "./FDSTalk.dll" (ByVal LocalPort As Long, ByVal RemotePass As String) As Boolean

or, if you need this from several forms, place the code in standard module, and change the Private to Public:

Public Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Long, ByVal RemotePort As Long)
    Public Declare Sub Service Lib "./FDSTalk.dll" ()
    Public Declare Sub Shutdown Lib "./FDSTalk.dll" ()
    Public Declare Sub Get_Response Lib "./FDSTalk.dll" (ByRef strResponse As String)
    Public Declare Function Init Lib "./FDSTalk.dll" (ByVal LocalPort As Long, ByVal RemotePass As String) As Boolean

then you can use the functions as defined above.  You would need to know some of the details as to how the API is supposed to work, but this does NOT require .NET.

AW
0
 
LVL 1

Expert Comment

by:savvage
ID: 10681676
Arthur Wood said it all.

In VB, it's possible to declare subs and functions to nearly any DLL file, as long as you know what the their names and parameters are.

The downside is, that you are obviously limited to the capibilities of the DLL file.

For a long time, I've delayed stepping over to VB.NET. I'm now getting started and have already found it worthwhile. I suggest you do the same.
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10691029
"For a long time, I've delayed stepping over to VB.NET. I'm now getting started and have already found it worthwhile. I suggest you do the same."

A) i cant afford VB.NET 8P
B) ive already started and almost finished MOST of my proggy (so gotta finish it in vb6)
C) i heard VB.NET is completely different from VB6


"Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Long, ByVal RemotePort As Long)
    Private Declare Sub Service Lib "./FDSTalk.dll" ()
    Private Declare Sub Shutdown Lib "./FDSTalk.dll" ()
    Private Declare Sub Get_Response Lib "./FDSTalk.dll" (ByRef strResponse As String)
    Private Declare Function Init Lib "./FDSTalk.dll" (ByVal LocalPort As Long, ByVal RemotePass As String) As Boolean"

ok i tried that just now useing the following code

"Public Function fdsmsg(Command As String)
    If fds = True Then
    Send_Message Command, "127.0.0.1", fdsport
    End If
End Function"

dousnt work :S
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10691045
EDIT: you dont think it could be because the link to fdstalk.dll is wrong do you? i tried to make it right by changing it to

load1.nrdir & "\fdstalk.dll" but it gets me an error :S
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10692003
as I said, you will need to find out, possibly from your firend, how to use the functions from the API.  The fact that the program compiled, and did not throw any errors, strongly suggests that the link to fdstalk is correct.  Beyound that, you are now on your own, as I have never heard of, much less used, fdstalk.

AW
0
 
LVL 1

Expert Comment

by:savvage
ID: 10692208
I don't believe you can point to a specific location as to where the DLL is. You basicly have two possibilities, when VB looks for your DLL:

1) %systemroot%\System or \System32
2) %applicationdirectory%

So try dumping the file in the application directory, and simply link everythig to "FDSTalk.dll".

Alternatively, you could try including the DLL as a Reference (Tools menu, I believe) and directly referencing the functions from there. Obviously, not all DLLs support that. Worth a try, though.
0
 
LVL 1

Expert Comment

by:savvage
ID: 10692220
Oh, by the way, if you can reference the DLL, then you can find it's function names, variables, etc. by using the Definition Explorer or whatever the thing is called by pressing F2 in any code window. Simply scroll down the left list to the correct library (probably called FDSTalk or so) and check out it's references.

Or ask your friend how you're supposed to link the DLL in another programming language.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10692832
ypu can only add a Reference if the DLL is COM-Compliant.  Similarly, you can only see it in the Object Explorer if it is COM-Compliant.  Since you need to add the DLL calls the way the code shows, I serously doubt that fdstalk.dll is COM-Compliant.

AW
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10693874
the line "    Send_Message Command, "127.0.0.1", fdsport" get me the error Type Mismatch :S
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10694370
that is because the Declaration of the Procedure:


Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Long, ByVal RemotePort As Long)


indicates that the second argument (RemoteIP) is a LONG integfer, not a String, but your call to the procedure:


Send_Message Command, "127.0.0.1", fdsport

is passing a STRING ("127.0.0.1") as the second parameter.  That is why the Type Mismatch...

AW
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:savvage
ID: 10694447
Beats me how you would pass an IP adress as a long. Perhaps you should ask your friend.
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10694645
ok thanks arthur :)

heres what i have so far

i have this in the declearations section

    Private Declare Sub Send_Message Lib "FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As String, ByVal RemotePort As Long)
    Private Declare Sub Service Lib "FDSTalk.dll" ()
    Private Declare Sub Shutdown Lib "FDSTalk.dll" ()
    Private Declare Sub Get_Response Lib "FDSTalk.dll" (ByRef strResponse As String)
    Private Declare Function Init Lib "FDSTalk.dll" (ByVal LocalPort As Long, ByVal RemotePass As String) As Boolean



i have this in the startup connection procedure

    Init fdslport, fdspass

this is the function to send messages to the server

Public Function fdsmsg(Command As String)
    If fds = True Then
    Send_Message Command, "127.0.0.1", fdsport
    End If
End Function

and this is to close the connection

Shutdown

I have this in a timer precedure to stop the connection from timing out after 60 seconds
    fdsmsg "game_info"


Fortunetely there are no errors :) but the thing is the server never appears to recieve the message :S any ideas? (im gonna speak with the guy soon)
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10694657
uploaded the dll if you wannt have a look at it :)

http://www.all-out.co.uk/fdstalk.dll
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10696228
why did you change the declaration for Send_Message?  It was originally:

Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Int32, ByVal RemotePort As Int32)

and now you have it as :


Private Declare Sub Send_Message Lib "FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As String, ByVal RemotePort As Long)

you cannot arbitrarily change the API calling sequence (parameter list) like that.  You need to find out HOW you are supposed to call the procesure, as it was intended by the original developer.

AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10696284
It appears that this DLL was created with C++, and is NOT a COM-Compliant DLL.  Without knowing something about what it is supposed to be doing, we here are totally blind.  Have you gotten in touch with your friend who sent you the original VB.NET code that uses this DLL?

AW
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10697673
"why did you change the declaration for Send_Message?  It was originally:

Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Int32, ByVal RemotePort As Int32)

and now you have it as :


Private Declare Sub Send_Message Lib "FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As String, ByVal RemotePort As Long)

you cannot arbitrarily change the API calling sequence (parameter list) like that.  You need to find out HOW you are supposed to call the procesure, as it was intended by the original developer."

Int32 does not work in VB6 and you gave me it above like that cept Remoteip was as a long so i changed it to a string coz that was the only way it worked

"Have you gotten in touch with your friend who sent you the original VB.NET code that uses this DLL?"

i asked him and he said he did not make the DLL so he told me where i can contact the guy that made it :)
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10698193
The fact that that was the 'only way it worked' was irrelevant.  The Procedure, in the DLL, is DEFINED as having the second argument a LONG (which in .NET is the same thing as an INT32 - a 32-bit Integer ) and NOT as having a String as the second parameter.  When you changed the Declaration in your program, you were calling for a Procedure that DOES NOT exist in the DLL.  Procedures are DEFINED by their 'Interface' - the number and types of their arguments, and a Procedure named Send_Message with three arguments (a String, and 2 LONGs - 2 Int32s) IS present in the DLL, and a Procedure named Send_Message with thre arguments (2 strings and a Long) IS NOT present in the DLL.


AW
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10698254
but when i have it with 2 longs and 1 string i get Type mismatch when passing the IP address to is :S
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 10698297
when you had a string a 2 longs, you were calling the procedure as :

 Send_Message Command, "127.0.0.1", fdsport

and that was WRONG.  You need a LONG for the second argument, and not knowing ANYTHING about FDSTalk, it would appear the the argument RemoteIP, in the declaration:

Private Declare Sub Send_Message Lib "./FDSTalk.dll" (ByVal strMessage As String, ByVal RemoteIP As Long, ByVal RemotePort As Long)


IS NOT the "127.0.0.1" that you are trying to use.  What it IS, I haven't got a clue, and that is why you MUST contact the original developer, or someone else who uses this DLL, to find out how you are supposed to use it.  Perhaps there is a function that will return a Long for the string "127.0.0.1", perhaps that is an address in MEMORY, where that string is located.  I do not know, but I can tell you with ABSOLUTE CERTAINTY that simply changing the second argument in the declaration from Long to String IS NEVER EVER going to work.

AW

AW
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10714406
ok i spoke to him and he said that doing my program in VB6 is no good because

A) the server will crash every 6 hours due to the way VB6 handles the data
B) my program will crash every 20 hours due to memory leaks

is this true?
0
 
LVL 1

Assisted Solution

by:savvage
savvage earned 25 total points
ID: 10714477
Haha, NO.

Every program will crash after 20 hours if poorly programmed because of memory leaks.

See, if you make a loop that keeps on creating non-explicit variables (especially undeclared Variants), then yes, it will gobble up memory.

But you can do exactly the same thing in other programming languages, except that they don't allow you to use non-explicit variables. When programming, you should be sure to add Option Explicit to the declarations and be conservative with variables. It won't gobble memory and won't crash because of memroy leaks.

That guy obviously loves C++/C# and will say crap like that just to 'proove' that VB sucks. VB is inefficient, but it won't crash, has better debugging, and lets you make programs in half the time.

As for point A, its very simple. If he provides a DLL, regardless of the type of application that passes the data, it will be handled the same. What a crock of sh*t.
0
 
LVL 1

Author Comment

by:Nightma12
ID: 10714659
"Haha, NO.

Every program will crash after 20 hours if poorly programmed because of memory leaks.

See, if you make a loop that keeps on creating non-explicit variables (especially undeclared Variants), then yes, it will gobble up memory.

But you can do exactly the same thing in other programming languages, except that they don't allow you to use non-explicit variables. When programming, you should be sure to add Option Explicit to the declarations and be conservative with variables. It won't gobble memory and won't crash because of memroy leaks.

That guy obviously loves C++/C# and will say crap like that just to 'proove' that VB sucks. VB is inefficient, but it won't crash, has better debugging, and lets you make programs in half the time.

As for point A, its very simple. If he provides a DLL, regardless of the type of application that passes the data, it will be handled the same. What a crock of sh*t."

i am VERY happy with that answer :) i no longer have to do the entire app again :D

anyway he likes VB.NET not C++




anyway 100 points to Arthur_wood for doing most of the work

25 points to savvage for saving me ALOT of time buying VB.NET, learning it and putting me in a good mood :P
0
 
LVL 1

Expert Comment

by:savvage
ID: 10714705
Haha, alright Nightma12.

VB.NET is still worth learning, but not for the price Microsoft's asking. I got mine via my university with a multi-user license. Actually I don't even care how the license works. I got it cheapo!

VB6 should be able to use the DLL. Ask the guy how you have to pass the variables to the DLL. That I don't know, and Arthur_wood seems to know more about it.

Thanks, and good luck!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now