Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass value to vbScript in a ASP.NET page

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I am writing code to add a printing function in my .Net page. The print function is called by a block of VBScript code which is provided by label printer company.
My problem is how to pass Street value to these VBScipt code from my ASP.NET variables. For example, use Session("StreetAddress")
Here is the sample code:
*********************************************************
<%@ Page Language=&quot;vb&quot; AutoEventWireup=&quot;false&quot; Codebehind=&quot;LabelPrint.aspx.vb&quot; Inherits=&quot;HelpDesk.WebForm2&quot;%>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
Sub Btn1_onclick()
Dim DymoAddIn, DymoLabel
Set DymoAddIn = CreateObject(&quot;DYMO.DymoAddIn&quot;)
Set DymoLabel = CreateObject(&quot;DYMO.DymoLabels&quot;)

DymoAddIn.Open &quot;C:\Program Files\Dymo Label\Label Files\Address (30252, 30320).LWT&quot;
DymoLabel.SetAddress 1,&quot;Session(&quot;StreetAddress&quot;)&quot;+chr(10)+&quot;SAMPLE Corporation&quot;+chr(10)+&quot;333 W. Fantasy World&quot;+chr(10)+&quot;Santaland, NP 99999-9999&quot;
DymoAddIn.Print 1, TRUE
End Sub
</SCRIPT>
<head>
<title>Label Print</title>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft Visual Studio.NET 7.0&quot;>
<meta name=&quot;CODE_LANGUAGE&quot; content=&quot;Visual Basic 7.0&quot;>
<meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript&quot;>
<meta name=&quot;vs_targetSchema&quot; content=&quot; </head>
<body MS_POSITIONING=&quot;GridLayout&quot;>
<form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;>
<Bold><p></p>Label Printing Demo</Bold></p> <INPUT TYPE=&quot;BUTTON&quot; NAME=&quot;Btn1&quot; VALUE=&quot;Print Label&quot;>
</form>
</body>
</html>
*********************************************************

Thanks!
 
cjlarue,

Thank you for your reply. Your answer is what exactly I figured out by myself. But I have another problem with these codes. If I use 'Session(&quot;StreetAddress&quot;)=Session(&quot;StreetAddress1&quot;) & Chr(10) & Session(&quot;StreetAddress2&quot;)', I will have a run time error 'Unterminated constant'. I guess this is caused by Chr(10) which is used to add a carriage return to the code. I wonder if you or some one else can help me answer this question too.
Thank you again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top