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. Visual Basic
  4. passing parameter to run method at msscriptcontrol

passing parameter to run method at msscriptcontrol

Scheduled Pinned Locked Moved Visual Basic
helptutorialdata-structuresquestion
4 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.
  • A Offline
    A Offline
    aphei
    wrote on last edited by
    #1

    in my project, i need a lot of different formulas so there is no standard formula and parameter the parameter will write on textbox, the formula in richtextbox example: formula 1 Parameter = test1, test2 (so there are 2 parameters) formula = test1 * test2 formula 2 Parameter = test1, test2, test3 formula = (test1 * test2) / test3 when i execute the formula i write strExec = "Dim formula" & vbCrLf strExec = strExec & "Sub Main (" & parameter & ")" & vbCrLf strExec = strExec & formula & vbCrLf strExec = strExec & "End Sub" & vbCrLf i use VBScript as the language the problem is, when the run method msScript.Run("Main", xxx) the parameter doesn't have a standard value, i may 2 or 3 parameter how to write in the xxx part? i have try using array, but it return error thanks

    L 1 Reply Last reply
    0
    • A aphei

      in my project, i need a lot of different formulas so there is no standard formula and parameter the parameter will write on textbox, the formula in richtextbox example: formula 1 Parameter = test1, test2 (so there are 2 parameters) formula = test1 * test2 formula 2 Parameter = test1, test2, test3 formula = (test1 * test2) / test3 when i execute the formula i write strExec = "Dim formula" & vbCrLf strExec = strExec & "Sub Main (" & parameter & ")" & vbCrLf strExec = strExec & formula & vbCrLf strExec = strExec & "End Sub" & vbCrLf i use VBScript as the language the problem is, when the run method msScript.Run("Main", xxx) the parameter doesn't have a standard value, i may 2 or 3 parameter how to write in the xxx part? i have try using array, but it return error thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      aphei wrote:

      how to write in the xxx part?
      i have try using array, but it return error

      Like this;

      ref myArrayName

      I are Troll :suss:

      A 1 Reply Last reply
      0
      • L Lost User

        aphei wrote:

        how to write in the xxx part?
        i have try using array, but it return error

        Like this;

        ref myArrayName

        I are Troll :suss:

        A Offline
        A Offline
        aphei
        wrote on last edited by
        #3

        umm.. so, i just write msScript.Run("Main", ref strParam)? it returns error name ref is not declare comma, ')', or a valid expression continuation expected. do i need to imports anything? thanks

        L 1 Reply Last reply
        0
        • A aphei

          umm.. so, i just write msScript.Run("Main", ref strParam)? it returns error name ref is not declare comma, ')', or a valid expression continuation expected. do i need to imports anything? thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi,

          aphei wrote:

          msScript.Run("Main", ref strParam)

          My apologies, accidentally posted c# syntax. Guess that would be "ByRef" in VB.NET, but I can't try it at the moment.

          aphei wrote:

          do i need to imports anything?

          Only the reference to the scriptcontrol, and I think you already have that :)

          I are Troll :suss:

          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