Convert VB6 code to VB.NET

Hi, I am new to CURSOR and have no experience in modern coding tools (I can code VBA in Excel). I have a one-off project converting VB6 code to VB.NET, which I thought would be easy with AI. But I’ve been amazed at how awful I’ve found it. What am I doing wrong? I have taken it form by form, module by module. And I have asked it to learn from mistakes and record it in a Learning Script. But it does crazy things. Eg there is a Save/Load to a file facility in the VB6 code. After searching for a bug in the new code for ages, I discovered that CURSOR had decided to change the variables saved from the VB6 code to its VB.NET. Another example, at one stage I pointed out to CURSOR that it had made duplicate declarations of variables, it offered to solve this for me throughout the code and I agreed, then and it took hours working on it. The result was declarations duplicated 200 times creating about 8000 extra lines of code! I guess I will never agree to anything CURSOR offers to do. What am I doing wrong?

Hey, it may be that the underlying LLMs do not have much experience with VB6 code and its relationship to VB.NET code. However, to get some more positive outputs, I’d recommend breaking down what you want to do into small chunks and confirm it’s working correctly.

Cursor does not work well if you throw a lot of information or requests at the AI, but should work fine if you work methodically through your issue.

Unfortunately, I do not know VB6 or VB.NET well, so I can’t offer any specific advice, but hopefully, others on the forum can!

Thanks Dan. I thought that I was breaking it down into small chunks. The total is 10,000 lines of active VB6 and I have been adding routines of about 300 lines one by one. I will persevere.

Doing a 1-to-1 conversion is unlikely to work well as the AI will loose the context of what its implemented already as it continues through your code.

The best way to do this is likely to almost “start from scratch”, getting the AI to rebuild your code in VB.NET by describing the functionality you need it to add, and giving it code examples from your VB6 code.

Unfortunately, throwing chunks of VB6 code one by one will almost definitely fail - LLMs are not quite up to that threshold yet!

Can I ask which model you are using ?

I don’t understand the question … unless the answer is Claude. I am not aware I have a choice.

You can choose the model you want to use in Chat / Composer, etc.
See the list in the lower left of the chat window.

Dan, that’s surprising. I get best results when I ask it to just convert the syntax and keep the VB6 logic. It’s when it starts thinking for itself that thing go wrong, like the examples I gave - outputting it’s own choice of variables and offering to sort out variable declarations (and my foolish acceptance of the offer).

Kez, Should I change the model?

I use mostly Claude Sonnet 3.5 20241022.
If it’s not in your list, you can add it in Cursor settings.


Kez, thanks, the sonnet one is my only Claude option. I see now that other options are gpt- and o1- variants.

It’ll be very good at simply converting the syntax, but if you have to do this multiple times, you may start to find the latest chunk of converted from the AI does not work with the existing VB.NET code, and things start to get out of sync a bit.

You may find using o1-mini (of which you have 10 free uses a day) to “confirm” the code every so often may work well, as that model has better intelligence, but is slow as it has a “thinking” step, where it checks its own response before you see it.

DeepSeek R1 has a nice thinking step to resolve bugs, but it’s so slow right now.

Dan, that’s really helpful. I have a question on alternative models like o1-mini, but first some more background …

The main program is a VB form which calls two kinds of functions via input forms. The first kind are utility functions which do things like save and reload the data set that the program is working on. The second kind are a set of engineering calculation routines. So far I’ve managed to get the main form working including a conversion from the VB6 code for 2 modules which provide: 1. background calculation tools and 2. file management tools. I now have got the utility functions working, including the forms. I have spent a lot of time getting the first and simplest engineering calculation routine connected: first its form which was easier and then linking to all the utility functions. Hopefully I am now at the stage where adding each new engineering calculation routine with its VB form will be more straightforward.

My question is - what is the best model to use when I introduce a new calculation routine with its form and VB6 code? I will want to show the model

the VB6 code for the new routine to add
the VB6 code for the first calculation routine
the VB.NET code for the first calculation routine
The VB.NET modules with the functions Subs etc which it will be calling.

Then I will ask it to convert the new routine to VB.NET. That seems a challenging task which could well be beyond the Claude model I’ve been using so far. I don’t mind if the new model is much slower. I can do other work. And this will be needed much less than 10 times a day. I can return to Claude to tidy things up.

Unfotunatly, there’s probably not one best model here.

Claude 3.5 Sonnet is the best for coding performance giving its speed, but for highly complex stuff, you may have to switch to o1, which has the “thinking” step that helps it to accomplish more complex changes.

Additionally, we have recently added DeepSeek v3 and R1, v3 is a Claude 3.5 Sonnet-style model that has similar (if not better in benchmarks) performance than Claude, and R1 is like o1 in its ability to thing before it acts, but is a premium model so is included in your Pro plan.

I’d say to experiment, as models perform differently depending on what they are working on. You may benefit from adding the relevant documentation into Cursor so the AI has it as context, or use @web if there’s something the AI may not already know, but could look up.

Thanks, Dan. I am finding this very helpful. I am finding the smaller the tasks I set the model to do, the faster I progress. I’ll give those models a try.

I have years of experience with vb6, Vb.net, and C#. You are much better off to start from scratch and utilize C# if you want to stay on DotNet. VB.Net is for all practical purposes a sunset language.