|
-
Jun 24th, 2005, 10:17 AM
#1
Thread Starter
Member
How do I call Vbscript functions from VB.net code behind files?
Hi gang,
I have a problem.
I need to call some VBScript function from my code behind file. Tis is because, only under certain condition, would the Vbscript function be needed to be called.
How do I go about doing it?
-
Jun 24th, 2005, 11:03 AM
#2
Re: How do I call Vbscript functions from VB.net code behind files?
Why dont you just rewrite the script function into the code behind?
-
Jun 24th, 2005, 11:34 AM
#3
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
 Originally Posted by Cander
Why dont you just rewrite the script function into the code behind?
Because the script function must be at client side.
meaning, it must be a client side coding. If i were to put it on server side, my authentication system will fail
Do you have some suggestions?
-
Jun 25th, 2005, 01:59 AM
#4
Re: How do I call Vbscript functions from VB.net code behind files?
-
Jun 25th, 2005, 02:00 AM
#5
Re: How do I call Vbscript functions from VB.net code behind files?
If it is, you can use Page.RegisterStartupScript() to execute your client side scripts on page load.
-
Jun 25th, 2005, 05:33 AM
#6
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
 Originally Posted by mendhak
If it is, you can use Page.RegisterStartupScript() to execute your client side scripts on page load.
Yes, it is ASP.NET Web app.
Thanks, i'll try
Last edited by aspfan; Jun 25th, 2005 at 05:40 AM.
-
Jun 25th, 2005, 09:45 AM
#7
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
Hi,
I manage to call my VBscript subroutine from my code behind file.
But i encounter another problem. The button is in my datagrid.
So, right now, im having problem doing it such that the attribute is not assigned to the button unless i click my button twice.
(clicking the button will invoke datagrid On_SelectedIndexChanged event.
It looks something like this. RolloverButton.Rollover is behaves just like a normal button.
Code:
Dim imgActivate As RolloverButton.RollOver = CType(dgSteps.SelectedItem.FindControl("imgActivate"), RolloverButton.RollOver)
imgActivate.Attributes.Add("onClick", "vbscript:StartScan()")
Looks like i have to put this set of coding somewhere..but where?
-
Jun 26th, 2005, 06:34 PM
#8
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
Page.RegisterStartupScript() .
I tried using it.
Looks like i have to type the whole VBscript in code behind file. Cant i just called the VBScript from code behind using Page.RegisterStartupScript() ?
-
Jun 27th, 2005, 12:00 AM
#9
Re: How do I call Vbscript functions from VB.net code behind files?
Yes. Place the function in the ASPX file, and in your Page.RegisterStartupScript, simply call the function/sub name.
-
Jun 27th, 2005, 06:41 AM
#10
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
 Originally Posted by mendhak
Yes. Place the function in the ASPX file, and in your Page.RegisterStartupScript, simply call the function/sub name.
I did that.
VB Code:
Dim strSCript As String = "<script language=VBScript>Call StartScan()</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strSCript)
End If
Thats what i did. however, it return me a dialog box pop up saying "End of statement expected".
I dont understand what it means. Something went wrong?
-
Jun 28th, 2005, 02:05 AM
#11
Re: How do I call Vbscript functions from VB.net code behind files?
You get this error from the IDE or on the web page?
-
Jun 28th, 2005, 09:55 AM
#12
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
I got it on the web page. Meaning, when i preview the webpage on internet explorer, i got that error message.
-
Jun 29th, 2005, 12:40 AM
#13
Re: How do I call Vbscript functions from VB.net code behind files?
I think that means you have a script error in what youv'e written. Try checking the Sub you've witten
-
Jun 29th, 2005, 07:34 AM
#14
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
 Originally Posted by mendhak
I think that means you have a script error in what youv'e written. Try checking the Sub you've witten
That is weird.
Because, I tried calling it using ASP.NET button by adding attribute to the button. When i click the button, it behaves as expected( i did not change alter any of my VBScript)
Is it the limitation of RegisterStartupScript ?
As in, it could not call VBScript functions.
-
Jun 30th, 2005, 12:40 AM
#15
Re: How do I call Vbscript functions from VB.net code behind files?
Try it with a very simple VBScript call?
-
Jun 30th, 2005, 01:01 AM
#16
Re: How do I call Vbscript functions from VB.net code behind files?
Moved to ASP.NET Forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 30th, 2005, 11:57 AM
#17
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
 Originally Posted by mendhak
Try it with a very simple VBScript call?
Hi, Yes, i have tried it. Something like, changing the values of HTML textbox.
Still doesnt work.
Something wrong with my VS.NET ?
-
Jul 1st, 2005, 12:55 AM
#18
Re: How do I call Vbscript functions from VB.net code behind files?
Probably not. More likely with some code written. Would it be possible to post all of it?
-
Jul 1st, 2005, 01:50 AM
#19
Thread Starter
Member
Re: How do I call Vbscript functions from VB.net code behind files?
Hi,
Ok, heres the code in VB.
VB Code:
Private Sub dgSteps_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgSteps.SelectedIndexChanged
Dim strSCript As String = "<script language=VBScript>Call change()</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strSCript)
End If
The code in ASPX page is:
VB Code:
<script language="VBScript" defer>
Sub change()
document.Form1.textbox1.value = "Trytochange"
End Sub
</script>
As you can see, I want this VBscript sub to be called only when the datagrid is selected. Im using a button to select the row in the datagrid.
What is wrong with my coding ?
-
Sep 11th, 2007, 03:35 PM
#20
New Member
Re: How do I call Vbscript functions from VB.net code behind files?
I'm having the same problem
code
aspx.cs
Page.RegisterStartupScript("hey","<SCRIPT language=\"vbscript\"> \n call test() \n</SCRIPT>");
aspx
<SCRIPT language="vbscript">
'call test()
sub test
document.write("it works!!!!!!!!!!!!")
end sub
</SCRIPT>
this doesnt work, does anyone know why????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|