Results 1 to 6 of 6

Thread: is it possible to execute vbs in vb.net?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Posts
    18

    is it possible to execute vbs in vb.net?

    guys, is it possible to execute a vbscript in the vb.net? i want to click a button, then a function will execute the vbscript..

    thanks

  2. #2
    Addicted Member
    Join Date
    Sep 2004
    Posts
    133
    Is it possible to re-write the VBS Script for .NET and run that in the button click event?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2004
    Posts
    18
    actually im trying to run the CDONTS send mail using vbs. tats y i prefer to execute the vbs

  4. #4
    Addicted Member
    Join Date
    Sep 2004
    Posts
    133
    I still suggest re-writing the code to .NET. Search the documentation for the MailMessage Class. You can send an email from an ASP.NET application, or a Windows Forms application using pretty much the same code (just need to add an additional reference in Windows Form).

    If you still have problems after looking at the docs let us know and we'll try to help further.

  5. #5
    New Member
    Join Date
    Oct 2004
    Posts
    2
    I have used the msscriptcontrol control to run vbscript. I referenced the control and then I used the code below under a button click event.

    Dim C As New MSScriptControl.ScriptControl
    C.Timeout = -1
    Try
    C.Language = "VBScript"
    'Using 'This' enable me to communicate from vbscript with the winform
    C.AddObject("This", Me)
    'Textbox1.text is a mutliline textbox with the vbscript code.
    C.ExecuteStatement(Textbox1.Text)
    Return True
    Catch Er As Exception
    msgbox(Er.ToString)
    Return False
    Finally
    msgbox("Code Run Completed..." & Now)
    End Try

    Hope I understood your problem and hope this helps.

  6. #6
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    MSDN has a couple of articles on using the MSScriptcontrol that ashsus mentioned. If you want to use VBScript this is the best way to go about it.

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