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. call a vb function with out paramaters

call a vb function with out paramaters

Scheduled Pinned Locked Moved C#
csharphelpquestion
6 Posts 5 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.
  • C Offline
    C Offline
    cmarmr
    wrote on last edited by
    #1

    i am using csharp and i am calling a dll that was written in vb 6 and one of its methods i call has a optional parameter how do i call this function without a parameter without throwing a compiler error

    Thanks, Chad Aiena

    P T L D 4 Replies Last reply
    0
    • C cmarmr

      i am using csharp and i am calling a dll that was written in vb 6 and one of its methods i call has a optional parameter how do i call this function without a parameter without throwing a compiler error

      Thanks, Chad Aiena

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I've never tried this so I'm only really guessing here, but have you tried passing in null?

      the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
      Deja View - the feeling that you've seen this post before.

      C 1 Reply Last reply
      0
      • P Pete OHanlon

        I've never tried this so I'm only really guessing here, but have you tried passing in null?

        the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
        Deja View - the feeling that you've seen this post before.

        C Offline
        C Offline
        cmarmr
        wrote on last edited by
        #3

        yes and it did not work

        Thanks, Chad Aiena

        1 Reply Last reply
        0
        • C cmarmr

          i am using csharp and i am calling a dll that was written in vb 6 and one of its methods i call has a optional parameter how do i call this function without a parameter without throwing a compiler error

          Thanks, Chad Aiena

          T Offline
          T Offline
          Thomas Stockwell
          wrote on last edited by
          #4

          VC# if I am correct does not support optional parameters. Have you tried creating an empty object of the type the parameter is set to be. Or you could possibly import Microsoft.VisualBasic namespace and use the vbNull constant and use that. What is the compiler error?

          Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my homepage Oracle Studios[^]

          1 Reply Last reply
          0
          • C cmarmr

            i am using csharp and i am calling a dll that was written in vb 6 and one of its methods i call has a optional parameter how do i call this function without a parameter without throwing a compiler error

            Thanks, Chad Aiena

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, I havent done this (I am not actively using VB) but I guess you cannot really do it, unless you cheat a little by inserting a code layer in C# that offers you two methods (one with, one without the optional out parameter), and have them both call the VB code WITH the out parameter present (one real, one dummy). :)

            Luc Pattyn

            1 Reply Last reply
            0
            • C cmarmr

              i am using csharp and i am calling a dll that was written in vb 6 and one of its methods i call has a optional parameter how do i call this function without a parameter without throwing a compiler error

              Thanks, Chad Aiena

              D Offline
              D Offline
              Dave Doknjas
              wrote on last edited by
              #6

              Just pass "System.Reflection.Missing.Value" for the optional parameter.

              David Anton www.tangiblesoftwaresolutions.com Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: C# to C++ converter, VB to C++ converter Instant Python: C# to Python converter, VB to Python converter

              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