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. Executing a string value

Executing a string value

Scheduled Pinned Locked Moved Visual Basic
questioncsharpcomtools
4 Posts 3 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.
  • T Offline
    T Offline
    THEMYTH
    wrote on last edited by
    #1

    Hello I want to execute a string value in VB.NET e.g. dim a as string a = "msgbox "Emre"" .. a When I execute this statement it must show the messagebox. In VB6 I was using Script ActiveX Component. How can I do that in VB.NET? Thanks Best Regards Emre YAZICI

    D 1 Reply Last reply
    0
    • T THEMYTH

      Hello I want to execute a string value in VB.NET e.g. dim a as string a = "msgbox "Emre"" .. a When I execute this statement it must show the messagebox. In VB6 I was using Script ActiveX Component. How can I do that in VB.NET? Thanks Best Regards Emre YAZICI

      D Offline
      D Offline
      dickysingh
      wrote on last edited by
      #2

      Hi, I used this code on button1_click of a button in Windows form and it displayed me with the messagebox Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strMsg As String Dim strMsgNew As String = "Pritpal Singh Bumrah" strMsg = MsgBox(strMsgNew) strMsg.ToString() End Sub I hope this should solve your problems dickysingh Nothing New

      T 1 Reply Last reply
      0
      • D dickysingh

        Hi, I used this code on button1_click of a button in Windows form and it displayed me with the messagebox Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strMsg As String Dim strMsgNew As String = "Pritpal Singh Bumrah" strMsg = MsgBox(strMsgNew) strMsg.ToString() End Sub I hope this should solve your problems dickysingh Nothing New

        T Offline
        T Offline
        THEMYTH
        wrote on last edited by
        #3

        Thank you for your answer My problem is more complicated. Please consider there is a textbox and a button in my form When i click to the button the code that i wrote it into textbox , must be executed. But i will not use only msgbox. I will use all of the Vb.NET functions like (int - left - mid ....) I used to develop it in vb6 using scripting control object it was able to use ... script1.execute text1.text like this.. It executes the code that i have written into textbox. Thanks Best Regards Emre YAZICI

        D 1 Reply Last reply
        0
        • T THEMYTH

          Thank you for your answer My problem is more complicated. Please consider there is a textbox and a button in my form When i click to the button the code that i wrote it into textbox , must be executed. But i will not use only msgbox. I will use all of the Vb.NET functions like (int - left - mid ....) I used to develop it in vb6 using scripting control object it was able to use ... script1.execute text1.text like this.. It executes the code that i have written into textbox. Thanks Best Regards Emre YAZICI

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          There is nothing that says you can't do the exact same thing in VB.Net. All you have to do is go to the references folder in your project, right click it and select Add Reference. Go to the COM tab, scroll down to Microsoft Script Control 1.0, double-click it then click OK. Back in your project, open the code for your Form and put the following line BEFORE the Public Class statement for your Form:

          Imports MSScriptControl

          Now declare a script control object in an appropriate place in your code, set the control to the language you want to use, and tell it to execute the code you want. Here is a short example:

          Imports MSScriptControl
          Public Class Form1
          Inherits System.Windows.Forms.Form
          ' Windows Form Designer generated code
          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Dim script As New MSScriptControlClass
          script.Language = "VBScript"
          script.ExecuteStatement("msgbox ""This is a test...""")
          End Sub
          End Class

          RageInTheMachine9532

          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