Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Use C# for Addin in Excel

Use C# for Addin in Excel

Scheduled Pinned Locked Moved C#
questioncsharpdatabasetutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fardoche6
    wrote on last edited by
    #1

    i already did in VB few month ago, and i want to do the same in C#. the function insert in DB the info i get in excel and works well. ' example in VB public function myFunction(byval LastName as string, byval FirstName as string, optional Email as string="NA", optional PhoneNbr as long=0) end function // now how can i do the same in C#? i can do with polymorphiste but if some function have 20 argument, i need 400 different functions to do the equivalent of vb? the missing value work, but i need to put all the argument in object type. Fardoche

    S 1 Reply Last reply
    0
    • F Fardoche6

      i already did in VB few month ago, and i want to do the same in C#. the function insert in DB the info i get in excel and works well. ' example in VB public function myFunction(byval LastName as string, byval FirstName as string, optional Email as string="NA", optional PhoneNbr as long=0) end function // now how can i do the same in C#? i can do with polymorphiste but if some function have 20 argument, i need 400 different functions to do the equivalent of vb? the missing value work, but i need to put all the argument in object type. Fardoche

      S Offline
      S Offline
      Skynyrd
      wrote on last edited by
      #2

      If all ur optional parameters are the same type, u can use the 'params' keyword. U could use it even if they weren't the same type, but u would need to use an object array which u dont want. Otherwise, the only solution is to overload ur 400 different functions, C# does not support optional parameters. params[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups