This is a migrated thread and some comments may be shown as answers.

VB6 to C# : EOF expected

1 Answer 183 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bala
Top achievements
Rank 1
Bala asked on 09 Nov 2011, 07:44 AM
Hi,
I tried converting the small code given below from VB6 to C# and got the message:
Conversion Failed line 1 column 1, EOF expected.

Since this is a working code that I adapted from the web and use, I don't know how to proceed. I even tried deleting the first line -  this time again I got the same message. This happens at all new 'first' lines as I delete the previous ones. I know this query must be pretty naive to you gurus, but can anyone please help?
Thanks in advance.

Code:

Function USBNo()
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colitems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", , 48)
For Each objitem In colitems
If objitem.interfacetype = "USB" Then sernum = objitem.pnpdeviceid
Next
sernum = Mid(sernum, InStrRev(sernum, "\") + 1)
If sernum = "" Then
USBNo = ""
Else
USBNo = Left(sernum, InStr(sernum, "&") - 1)
'MsgBox USBNo
End If
End Function

Sub Login()
 Dim TargetU, TargetP As Range, LastRow As Long
 ' Checks for NO KEY OR WRONG KEY '010911
 u = frmLogin.TxtUser
 p = frmLogin.TxtPwd
 u = Trim(u)
 p = Trim(p)
 ABC = (Sheets("UserInfo").Range("X2"))
 VarLic = USBNo
 If VarLic = ABC Then
 GoTo Kontinue
 Else
 MsgBox "INSERT USB DONGLE or USE THIS FILE IN READ ONLY MODE WITH MACROS DISABLED!"   '010911
 
 u = ""
 p = ""
 Unload frmLogin
 Application.Quit   '010911
 Exit Sub
 'On Error GoTo 0
  End If
 
Kontinue:


Bala

1 Answer, 1 is accepted

Sort by
0
Todd
Telerik team
answered on 09 Nov 2011, 06:35 PM
Hello Bala,

Unfortunately, the Code Converter is designed to only convert between VB.NET and C#. It is not designed to convert VB6 to the equivalent .NET code (in either VB or C#). 

The task of converting a VB6 app to .NET can take some time. You may find the advice on this StackOverflow thread helpful:

http://stackoverflow.com/questions/395/how-do-you-migrate-a-large-app-from-visual-basic-6-0-to-vb-net 

Once your code is in VB.NET, you can use this converter to help change it to C#, if you prefer. Hope that helps.

-Todd

Tags
Code Converter
Asked by
Bala
Top achievements
Rank 1
Answers by
Todd
Telerik team
Share this question
or