C
C#7d ago
Flamur

Need help to port 1 big file of Visual Basic code to C#/.NET code

This code is used as a Macro in an Excel sheet to calculate a workers Fatigue and Risk Scores by collecting a list of data (Day On Duty, Off Duty, Commuting Time, Rest Time, Duty Length, Average duty per day Etc.), Link to Excel Sheet: https://lorhsems.com/wp-content/uploads/Rail/Element_25_Fatigue_Management/Attachments/HSE-UK-Fatigue-Risk-Calculator-v3.xls
16 Replies
Buddy
Buddy7d ago
$details
MODiX
MODiX7d ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
Buddy
Buddy7d ago
This isn't chatGPT, what exactly do you need help with? Break your problem up into smaller parts, do not form a question with "need help, here's file."
Flamur
FlamurOP7d ago
yep, so this file is very old dating on 2005 I think, and it uses some old formulas/algorithms, and I can't seem to understand half of it or where would I need to begin with it's main function is to calculate a workers Fatigue Score and that's the one I'm interested to translate to c#/.net
Buddy
Buddy7d ago
have you tried converting it yourself?
Flamur
FlamurOP7d ago
I kind of have with dnSpy and I have the code but it's even more confusing on IL or c# lol the math calculations are really complex brain not braining :/
sibber
sibber7d ago
id just give it to gpt or something and then review it
Buddy
Buddy7d ago
Know that this channel is intended for Q&A, not recruitment. Especially such a task as converting legacy code to C# which sounds to be a task for a business. It is more intended for questions such as: -"How do read a file in C#?" -"I get an error that says "foo" on line 215, This is my current code <insert link here>" AIs can be a good tool to use for doing such a task, it can at least give you a hint on what to use, but requires manual review after (as sibber mentioned).
Flamur
FlamurOP7d ago
I'll give it a go which model would yall recommend?
biohazrd
biohazrd7d ago
honestly id go with VS code insiders build since it has gpt 4.1 agent mode built in (provided you keep your usage under a certain threshold)
viceroypenguin
for the record, no one can help you since the vba is password protrected
JakenVeina
JakenVeina7d ago
the first thing you need to do is build yourself a BUNCH of test cases if you don't have any already just as wide a variety of inputs to this function as you can come up with and then the corresponding outputs that the current VBA code generates otherwise, you're not gonna have any idea whether your rewrite is correct or not ESPECIALLY if you plan on handing it off to an LLM
Unknown User
Unknown User6d ago
Message Not Public
Sign In & Join Server To View
viceroypenguin
they mentioned that it was a public resources document from the uk govt
MODiX
MODiX6d ago
Flamur
it's a public document that's used to be used by the UK Government (Where the company is stated, not where I'm from), but I'll post it on <#1007030034902548540> in a bit :>
Quoted by
<@294961273458655232> from #web (click here)
React with ❌ to remove this embed.
Unknown User
Unknown User6d ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?