Click here to Skip to main content
15,346,905 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Need to convert this code to c # code immediately. Can you help?

What I have tried:

VB
Sub D()
Dim SatirSayisi As Long
Klasor = "D:" & "\"
 SatirSayisi = Cells.SpecialCells(xlLastCell).Row / 6
 
 For n = 1 To Cells.SpecialCells(xlLastCell).Row Step SatirSayisi
 
     satirlar = Trim(Str(n)) & ":" & Trim(Str(n + SatirSayisi - 1))
 
     Rows(satirlar).EntireRow.Copy
 
     Workbooks.Add
 
     ActiveSheet.Paste
 
     Dn = Dn + 1
 
     Dosya = "Personel_" & Trim(Dn)
 
     ActiveWorkbook.SaveAs Filename:=Klasor & Dosya
 
     ActiveWorkbook.Close
 
     DoEvents
 
 Next
 
 MsgBox "İşlem Tamama"
 
 
 End Sub
Posted
Updated 27-Aug-20 4:27am
v5
Comments
Rick York 27-Aug-20 11:39am
   
No.

Quote:
Conversion from C++ to C#

First thing first: your code is not C++, it is vba.
Quote:
Need to convert this code to c # code immediately. Can you help?

Need a lot of money, immediately, can you help? :)

We are not a translation service.
You should have atalk with your teacher or think about hiring a professional programmer.
   
no one will do it here. Try developer for hire.

BTW: the code is Visual Basic - a very unloved langauge
   
Firstly, that isn't C++ - that's VB, probably VB6
Secondly, any code which explicitly calls DoEvents is by defintion rubbish code.

Thirdly, this is not a code conversion service: we are not here to translate code for you.
Even if we did, what you would end up with would not be “good code” in the target language – they are based on very different frameworks, and what makes something work in one language does not always “translate” directly into another.
So what you end up with is very poor code, that is difficult if not impossible to maintain, that can’t be upgraded nicely, and that will cause you immense headaches if the original is changed. And it’ll be a nightmare to debug if it doesn’t work “straight out of the box”.
Instead, use the source code as a specification for a new app written in and for the target language / framework and write it w=from scratch using the original as a “template”. You will get a much, much better result that will save you a lot of time in the long run.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900