CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    [RESOLVED] Problems with Excel Code

    Hallo Friends!
    I wanted to Change the following VB.net code to C#

    Code:
    Dim BestArray(,) As Object
    'I'm calling a method which fills the Excel sheet in a very short time
    ' 100.000 lines with 12 columns within 9 seconds
     Call ArrFillFromTopLeft(ws.Range(ws.Cells._Default(startRow, 1), ws.Cells._Default(startRow + 9, 11)), BestArray)
    
    ' The method itself Looks like
    
    	Public Sub ArrFillFromTopLeft(ByRef R As Excel.Range, ByRef Arr As Object) 
           'fills an entire Array from a single TopLeft-Cell-Range
            R.Resize(ArrRowCount(Arr), ArrColCount(Arr)).Value = Arr
    	End Sub
    I dont get a solution to port this VB.NET Code to C#
    Anyone has an Idea how to translate this in C# because you don't have any similar methods there which you have in VB.NET Thx for any suggestions in before
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Problems with Excel Code

    I had found an relativly easy Approach to handle that Problem.
    I created a Libraryusing exactly that methods. written in VB.NET so I did bnot have prblems with the code itself
    because he VB.NET code I aready had.
    Then I simple used that dll referenced it in y C# program so I can use that methods.
    Now most of my code is inC#whil only this dll containing some method accesing Excel.Range objects are written in VB.Nt.
    Tested Works.
    Last edited by JonnyPoet; April 16th, 2014 at 08:06 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured