Can I run vb script from C# application ? - asp.net

Can I run vb script from C# application.Can anybody provide me vb script with exam
like on button click show message,if perticular panel is visible.

i don't think you can run vb script code inside c# code, but this How to call a VBScript file in a C# application?
could do the job

You can't execute VBScript directly in the same C# process, but you can execute it through a separate process using the Process class.
Process.Start("path to vbscript", "arguments if any");
If you are talking about client side on a browser, then this can only work on IE (the only browser that supports vbscript).

Related

aspCode runner generates which syntax of CODE?

i'm using ASP RUNNER software to generate auto code, it generates this code
Function employeeRecord_Snippet1()
Response.Write "Your message"
End Function ' employeeRecord_Snippet1
now i don't understand that is it ASP.net code or ASP code ?
From the product homepage
"ASPRunnerPro creates professionally looking classic ASP applications enabling users to search, edit, delete and add data to the Oracle, SQL Server, MS Access, DB2, or MySQL databases."
http://xlinesoft.com/asprunnerpro/

How to insert activex in asp.net user control (ascx)

I have a newbye question about integration betweek ASP.NET (an ASCX controller) and ActiveX. I'm trying to insert SignDoc activeX in my application.
This component has a couple of dll but I cannot figure out how to insert it inside my control.
I'm using visual studio 2008 and the control is installed in a Sharepoint 2007 farm.
Thank you for any suggestion
First, It does not matter that you host in MOSS. It is an ActiveX and it will run on the client side browser. So, as long as it has no server side part or connection, you can start testing that inside a plain asp.net page. A bad side effect is that you need to register it on every client machine either manually or include it inside a CAB file with your asp.net page
Second,
You component has 2 dlls. You need to register them using regsvr32 tool.
I am not sure if every dll has a COM object inside or only one has the COM and the other is helper. So, you probably need to type the following 2 lines in command prompt:
regsvr32 -i "full path to dll1"
regsvr32 -i "full path to dll2"
If one of the above commands fails no problem, but at least one should succeed
The final step is the easiest, open a blank asp.net page in VS and expand the toolbox, and right click inside empty area of the toolbox and select "Choose Items", then add your ActiveX to the toolbox, then you can simply drag it to the page. If you switch to the source view of the page you will find the object tag.
Edit: In Windows 7 you most run the console as admin in order to execute successfully the regsvr32 command.
ActiveX are included in page using the object tag and the corresponding class id.
Read more about here: http://msdn.microsoft.com/en-us/library/ms970419.aspx

MessageBox.Show() not working in ASP.NET

I am trying to display some text using MessageBox.Show as shown below in a page_load event in ASP.NET. Before anyone jumps on the case why I am using it in ASP.NET, the use is for debugging only on my own dev box for a special need. There's a reference to System.Windows.Forms in the app.
I used it a few years ago so I know WinForm's MessageBox works. I am using .NET 4.0 and VS 2010. I don't think anything related to this function has changed.
MessageBox.Show("Message", "Caption", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); //used also ServiceNotification option
Any ideas why the message box doesn't display? I have only that line in the code.
ADDITION:
I am VERY AWARE of the message box thing implications. It's a temporary thing for debugging only. The line won't go into production. I have no access to javascript. Please put your thought into why it doesn't work instead of why I shouldn't be using it. I have used it before in 2.0 and it does work. I want to know if the newer .NET changed anything or I misused the option.
Direct Answer: it works in Visual Studio's web server , not in IIS.
The web application is hosted in a process that does not have a desktop, so you cant see any messageboxes.
#Tony, if you add System.Winform.dll to your rference, then you will be able to call message box.show at you development machine. But when you deploy it to some live server it will not work. So alternatively, you need to use javascript alerts. For this you can use this
private void ShowMessage(string message)
{
ScriptManager.RegisterClientScriptBlock(control, GetType(),"key","string.format("alert('{0}');",message),true);
}
Back in .Net 2.0 days, you could do this by including system.windows (I think) in your using statement.
Then, in the method, it would be system.windows.forms.Messagebox.show("foo");
I won't presume to tell you "yer doin it wrong"...
Just be aware that this will only show up on the server box, and could cause issues in a production environment.
The alert() is better, and console.log() is even better.

Clipboard in .Net VB.NET web forms

How to copy a text in asp.net page into Clipboard using vb.net code-behind ?
And what libraries to import ?
You can't copy text into clipboard from serverside because client's memory belongs to the client. You must use javascript for this purpose and that's browser dependent.
Here is a SO-link that'll help you to get started: how-to-copy-to-clipboard-in-javascript
They recommend to use zeroclipboard, i have no experiences with it.
Here is another SO-link with a simple example: how-to-actually-use-zeroclipboard-in-jquery
What you can do from serverside is to register a client script-block that will be executed on load of your webform to copy the text into clipboard as soon as possible.

Why is this code stopping? VB ASP.NET

Hey I am coding using Visual Studio 2003. My program worked fine until I introduced a dll I made using CreateObject.
Code:
Set docs2 = server.CreateObject("DocGetter.Form1")
docs2.GetDocument oXMLDom,numID
It appears to be getting stuck at this code. I've already used regasm to register the dll.
What else could be wrong?
Add a reference to the dll in your project and instantiate the object like this:
Dim docs2 As New DocGetter.Form1()
If that doesn't make sense, then fix it so it does. There's no good reason to use CreateObject in .Net code. (Okay, that's hyperbole. But the principal is sound).
Can you clarify - is this a web app or a client (winform) app? Form1 sounds like a winform. ASP.NET runs at the server, so showing a form would be inappropriate - it would happen at the server, not the client. In short, don't do this!
I also can't see where "stored procedures" figures in this, so I've removed the tag.
What are you trying to do? Options for showing something more complex at the client include:
dhtml
flash
silverlight
clickonce [requires windows client]
ocx [not recommended]
I'd bet money that this function isn't defined with this name and/or parameters.
docs2.GetDocument oXMLDom,numID
But because of the way you're instantiating the object, the compiler has no way of knowing this... I think.

Resources