vb6-migration

Using a VB6 Class in C#

删除回忆录丶 提交于 2019-11-29 09:18:56
Is it possible to use a VB6 class in C#? I think you should just be able to add the library that contains your VB6 type as a reference in your C# project. Visual Studio will create an Interop Assembly on the fly, and you'll get access to all of the types in the VB6 library via Runtime Callable Wrappers . The tool that creates the Interop Assembly is TLBIMP.EXE , and you can run this yourself if you want more control over the process, eg. if you want to create a Primary Interop Assembly that might be shared by multiple managed components. Jason You can use a compiled VB6 dll in a C# program by

How to declare a fixed-length string in VB.NET?

邮差的信 提交于 2019-11-29 03:40:20
How do i Declare a string like this: Dim strBuff As String * 256 in VB.NET? Use the VBFixedString attribute. See the MSDN info here <VBFixedString(256)>Dim strBuff As String It depends on what you intend to use the string for. If you are using it for file input and output, you might want to use a byte array to avoid encoding problems. In vb.net, A 256-character string may be more than 256 bytes. Dim strBuff(256) as byte You can use encoding to transfer from bytes to a string Dim s As String Dim b(256) As Byte Dim enc As New System.Text.UTF8Encoding ... s = enc.GetString(b) You can assign 256

How to migrate ugly and undocumented VB6 Code to .NET

二次信任 提交于 2019-11-28 22:29:46
问题 I know that there are already Questions about VB6 migration, but the code base of my project brings some new questions here. I have to say the Code quality, structure and architecture is just a nightmare. There are 2 Big Projects: Nr.1 with 40 Forms, 40 Modules and a few class files, this EXE is kind of a "base system". Nr.2 with 80 Forms, 20 Modules and a few class files again, this EXE calls functions form the "base system". Then there are ~10 other Projects with GUI (1-3 Forms each) and

Making a DLL COM accessible

[亡魂溺海] 提交于 2019-11-28 13:34:38
I have a class library written in .Net that I would like to make available to VB6/VBA. What I tried did not work (obviously as I am asking this question). Here is what I did: I Created a Class Library Project in Visual Studio 2010 Express and put the code in a Class Module. I opened the project properties and went to "Assembly Information" and checked "Make COM Visible". I went to "Advanced Compile" options and targeted .Net 2.0 (it's very simple code). I then removed all references expect for "System". I built the project (no warnings or errors) and copied the DLL out of the Bin folder into C

What's the simplest .NET equivalent of a VB6 control array?

泄露秘密 提交于 2019-11-28 13:30:36
Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()): Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Timer End Sub I know it's not very useful code, but it demonstrates the ease with which control arrays can be used in VB6. What is the simplest equivalent in C# or VB.NET? Make a generic list of textboxes: var textBoxes = new List<TextBox>(); // Create 10 textboxes in the collection for

vb6 control arrays in .net?

房东的猫 提交于 2019-11-28 04:44:10
问题 Are control arrays supported in .Net? We are talking about converting a legacy app from VB6 to .Net. The app has a lot of control arrays. I've read different articles that differ if .Net supports control arrays. Can anyone give me a definitive answer if .Net supports control arrays like VB6 does? Is this for the latest version of .Net 4.0? Or is there a version limitation? Also, if this is possible is it a straight conversion? If not what flaming hoops would one have to jump through to make

How do I figure out the correct argument structure for an unmanaged dll?

核能气质少年 提交于 2019-11-28 02:07:20
I was loading in some old VB functions from VBA, and mostly got everything updated to VB.NET, but there are function declarations for functions in "wininet.dll" which don't seem to match up correctly. The Error I'm getting is: Exception Thrown: Managed Debugging Assistant, 'PInvokeStackImbalance':... The long and short of it is that the length of the declared arguments needs to be explicit and it isn't matching up to the real functions in the dll. I looked this up and I can get by just removing the checks, but it will have a "stack imbalance" and eventually eat up all the stack over time as

Best Development tools for Upgrading from VB6.0 [closed]

淺唱寂寞╮ 提交于 2019-11-28 00:18:19
Im planning to upgrade a large vb6 application to .net. The project uses many third party components eg VSFlexGrid as well as crystal reports. It also uses old VB6 dlls whose source code is unavailable. My questions are Should I convert the source to C# or is VB.net robust enough? What do I do about third party components that are not supported or that use technologies that are insecure/obsolete? I would welcome any useful input from anybody who has done this before. MarkJ Here is an adaptation of a couple of my answers to similar questions. Converting automatically is a better choice than

How can I convert VB6 code to C#? [closed]

我的梦境 提交于 2019-11-27 19:38:44
Does anyone know a way to convert from VB6 code to C#? Is there a tool that can do this for me? VisualStudio offers (or at least offered) a wizard to do a conversion from VB6 to VB.NET (which could then be converted to C# with a bit of work, possibly helped by #develop's VB.NET <-> C# converter), but when last I used it, for anything non-trivial there was a lot of manual work needing to be done so I suspect you're probably better rewriting or porting by hand if this is a large and/or important application. It might come across as a little bit cheeky but your brain might be the best tool to use

Best Strategy for moving from VB6 to .NET [closed]

江枫思渺然 提交于 2019-11-27 09:17:17
My company has tons of legacy applications that are written in VB6. We are in transitions from moving VB6 applications to .NET (3.5 specifically). What would be the best strategy for moving form VB6 to .NET? NOTE : Below update should go to "Project Management" and has nothing to do with the main question. [UPDATE] : Thank you for your feedback so far Now there are more question that pop up are how would you assign developers to develop new applications? Should there be a special one-time upgrade division that will convert legacy apps to new ones? Or should every developer participate on