Declare variables in own subroutine

D

dancer

Using ASP.net 1.1 and VB

Is it possible to declare variables in their own subroutine?

I had my DIM statements within a sub that worked just fine.
I wanted to be able to use them in another sub, so I isolated them in their
own subroutine.
But when I call that subroutine within another sub and then try to use those
variables, it does not remember that they have been declared. I get the
message, "Name is not declared."

When I have those same variables declared in the exact same way WITHIN the
second sub it works fine.
 
J

James

dancer said:
Using ASP.net 1.1 and VB

Is it possible to declare variables in their own subroutine?

I had my DIM statements within a sub that worked just fine.
I wanted to be able to use them in another sub, so I isolated them in
their own subroutine.
But when I call that subroutine within another sub and then try to use
those variables, it does not remember that they have been declared. I get
the message, "Name is not declared."

When I have those same variables declared in the exact same way WITHIN the
second sub it works fine.


If you want a variable to be accessible from multiple routines, you'll
either have to declare the variable at a higher level, or do something like
passing it ByRef. If you can provide a trivial example of what you're doing
and trying to accomplish, even generically, it will probably be a lot easier
to get you from point A to point B.
 
D

dancer

Thanks for replying. Here is my example.
-------------------------------------------------
<%@ Page Language="VB" Debug = "true" ValidateRequest="false" %>

<%@ Import Namespace="System.Web.Mail" %>

<%@ Import Namespace="System.Data.Oledb" %>

<script language="VB" runat="server">

Sub SendMailandDatabase(Source As Object, E As EventArgs)

btnSendMail_OnClick

'I called another subroutine here, but to save you having to read so much
code, I eliminated it.

End Sub


Sub Declare_Var

Dim TheEmpName As String = EmpName.text

Dim TheHomeNumber As String = HomeNumber.text

Dim TheDateofAccident As String = DateofAccident.Text

Dim TheNotifyDate As String = NotifyDate.Text

Dim TheTimeAM As String = am.Text

Dim TheTimePM As String = pm.Text

Dim TheTime As String

Dim Thedie As String = Die.SelectedItem.Text

Dim TheLostDays As String = LostDays.SelectedItem.Text

Dim TheStateOfInjury As String = StateOfInjury.Text

Dim TheStreet As String = street.text

Dim TheCity As String = city.text

Dim TheAddressState as String = AddressState.Text

Dim TheZip As String = Zip.text

Dim Thebirth as String = Birth.Text

Dim TheSSN As String = SSN.text

Dim TheSex As String = Sex.SelectedItem.Text

Dim TheMarital As String = Marital.SelectedItem.Text

Dim TheContactNumber As String = ContactNumber.Text

Dim TheJob As string = Job.SelectedItem.Text

Dim ThePart As String = Part.Text

Dim TheSupervisor As String = Supervisor.Text

Dim TheHours As String = Hours.Text

Dim TheDays As String = Days.Text

Dim TheNature As String = nature.SelectedItem.Text

Dim TheDescription As String = Description.Text

Dim TheCaused As String = Caused.Text

Dim TheInitial As String = Initial.SelectedItem.Text

Dim TheProvider As String = Provider.SelectedItem.Text

Dim TheAdmitted As String = Admitted.SelectedItem.Text

Dim TheProviderName as String = ProviderName.Text

Dim TheProviderStreet as string = ProviderStreet.Text

Dim TheProviderCity as string = ProviderCity.Text

Dim TheProviderPhone as string = ProviderPhone.Text

Dim Thefull as String = Full.Text

Dim TheFullNew As String

Dim TheOccur As String = Occur.SelectedItem.Text

Dim TheWhere As String = Where.Text

Dim TheAccidentStreet As String = AccidentStreet.Text

Dim TheAccidentCity As String = AccidentCity.Text

dim TheAccidentState as String = AccidentState.Text

Dim TheAccidentZip as String = AccidentZip.Text

Dim TheOtherClaims as String = OtherClaims.SelectedItem.Text

Dim TheSafetyDevices as string = SafetyDevices.selectedItem.Text

Dim TheDevicesUtilized as string = DevicesUtilized.selectedItem.Text

Dim TheWitness as string = Witness.SelectedItem.Text

Dim TheWitnessName as String = WitnessName.Text

Dim TheReceivePay as String = ReceivePay.SelectedItem.Text

Dim TheComments as String = Comments.Text

Dim TheCommentsNew as String

Dim ThePrevented as String = Prevented.Text

Dim ThePreventedNew as String

Dim TheSubmitter As String = Submitter.Text

Dim TheTitle As String = Title.Text

Dim TheToday As String = Today.Text

Dim TheLocation As String = Location.SelectedItem.Text

Dim myMessage As New MailMessage

Dim myMail As SmtpMail

Dim strEmail As String

Dim UserMessage As String


End Sub



Sub Get_Info

myMessage.Body = "<h2>Wheeler's Express Accident Report Form</h2>" & vbCrLf
_

& " <p>" & vbCrLf _

& "<html><body> <table width = ""750"" bgcolor=""#E9EDF4"" height=""25""
border=""1"" cellpadding=""1"" cellspacing=""0""fontface=""Verdana""
Size=""2"">" & vbCrLf _

& "<td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> BASIC CLAIM
FACTS</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Employee's Name: <b> " &
TheEmpName & "</b></td>" & vbCrLf _

& "<td colspan=""2""> <font face=""Verdana"" Size=""2"">Home Phone Number:
<b>"& TheHomeNumber & "</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Date of Injury: <b>" &
TheDateOfAccident & "<br>" & "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Time of Injury: <b>" & TheTime &
"<br>" & "</td></tr>" & "</b></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Date Employer Notified:<b> " &
TheNotifyDate & "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Did Employee Die?<b> " & Thedie &
"</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""1""> <font face=""Verdana"" Size=""2"">Has the Injured
Employee Lost Days From Work?<b> " & TheLostDays & "</b></td>" & vbCrLf _

& "<td colspan=""2""> <font face=""Verdana"" Size=""2"">What State Did
Injury Occur? <b> " & TheStateOfInjury & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> EMPLOYER
INFORMATION</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""> <font face=""Verdana"" Size=""2"">Employer Name:
</td></tr>" & vbCrLf _

& "<tr><td height=""35"" valign=""bottom"" colspan=""3""><font
face=""Verdana"" Size=""2""> Work Location: <font face=""Verdana""
Size=""1"">
(street)&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"
& vbCrLf _

&
"(city)&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp(state)&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp(Zip)</td></tr>"
& vbCrLf _

& "<tr><td colspan=""3""> <font face=""Verdana"" Size=""2"">Nature of
Business: </td></tr>" & vbCrLf _

& "<tr><td colspan=""3""> <font face=""Verdana"" Size=""2"">Employee FED ID:
</td></tr>" & vbCrLf _

& "<tr><td colspan=""3""> <font face=""Verdana"" Size=""2"">Liberty Mutual
Policy # &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" &
vbCrLf _

&
"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
Store# </td></tr>" & vbCrLf _

& "<tr><td colspan=""1""> <font face=""Verdana"" Size=""2"">Employer Code:
</td>" & vbCrLf _

& "<td colspan=""2""> <font face=""Verdana"" Size=""2"">Employer Location
Code: </td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Employer SIC Code: </td>" &
vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Employer Type: </td></tr>" &
vbCrLf _

& "<tr><td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> INJURED EMPLOYEE
</b></td></tr>" & vbCrLf _

& "<tr><td colspan= ""3""><font face=""Verdana"" Size=""2""> Home Address:
<b>" & TheStreet & "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" & TheCity &
"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" & TheAddressState & "&nbsp&nbsp&nbsp" &
TheZip & "</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Date of Birth:<b>" & TheBirth
& "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">SSN:<b> " & TheSSN & "</b></td>" &
vbCrLf _

& "<td> <font face=""Verdana"" Size=""2""><b> " & TheSex & "</b></td></tr>"
& vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Marital Status:<b> " &
TheMarital & "</b></td>" & vbCrLf _

& "<tr><td colspan = ""3""> <font face=""Verdana"" Size=""2"">Phone Number
where Employee can be contacted:<b> " & TheContactNumber & "</b></td></tr>"
& vbCrLf _

& "<tr><td><font face=""Verdana"" Size=""2"">Job Description:<b> " & TheJob
& "</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2"">Supervisor's Name:<b> " &
TheSupervisor & "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2""> Hire Date: " & "</b></td></tr>" &
vbCrLf _

& "<td colspan=""2""> <font face=""Verdana"" Size=""2"">Work Per Week <b>" &
TheHours & "</b>&nbsp&nbsp Hours <b>" & TheDays & "</b>&nbsp&nbsp Days </b>
</td>" & vbCrLf _

& "<tr><td><font face=""Verdana"" Size=""2""></td></tr>" & vbCrLf _

& "<tr><td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> INJURY OR ILLNESS
</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""> <font face=""Verdana"" Size=""2"">Which Part of
the Body Was Injured? <b> " & ThePart & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> What was the
Nature of Injury? <b>" & TheNature & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Injury/Illness
Description <b> " & TheDescription & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Initial Medical
Treatment: <b> " & TheInitial & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2"">What Type of
Medical Provider Performed Treatment? <b>" & TheProvider & "</b></td></tr>"
& vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Was Employee
Admittted into a Hospital? <b>" & TheAdmitted & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Medical Provider
Name: <b>" & TheProviderName & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Medical Provider
Address: <b>" & TheProviderStreet & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Medical Provider
City State: <b>" & TheProviderCity & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Medical Provider
Phone: <b>" & TheProviderPhone & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Give a Full
Description of the Accident: <b>" & TheFullNew & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> What Caused The
Injury? <b>" & TheCaused & "</b></td></tr>" & vbCrLf _

& "<tr><td><font face=""Verdana"" Size=""2""> Did the Accident Occur at the
Store or Plant? <b>" & TheOccur & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""2""> <font face=""Verdana"" Size=""2""> If No, where
did the accident occur?<b>" & TheWhere & "</b></td>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Accident Address <b>" &
TheAccidentStreet & "</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Accident City <b>" &
TheAccidentCity & "&nbsp" & TheAccidentState & "&nbsp" & TheAccidentZip &
"</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Are Other Claims Involved?
<b>" & TheOtherClaims & "</b></td>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Safety Devices Provided? <b>"
& TheSafetyDevices & "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2""> Safety Devices Utilized? <b>" &
TheDevicesUtilized & "</b></td></tr>" & vbCrLf _

& "<tr><td> <font face=""Verdana"" Size=""2""> Was There a Witness <b>" &
TheWitness & "</b></td>" & vbCrLf _

& "<td colspan=""2""> <font face=""Verdana"" Size=""2""> If yes, ListName
<b>" & TheWitnessName & "</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> DISABILITY STATUS
</b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""> Did Employee
Receive Pay for Date of Injury? <b>" & TheReceivePay & "</b></td></tr>" &
vbCrLf _

& "<tr><td colspan=""3"" bgcolor=""maroon"" align=""center""> <font
face=""Verdana"" Size=""2"" color=""white""><b> ADDITIONAL COMMENTS &
INFORMATION </b></td></tr>" & vbCrLf _

& "<tr><td colspan=""3""><font face=""Verdana"" Size=""2""><b>" &
TheCommentsNew & " </b></td></tr>" & vbCrLf _

& "<tr> <td> <font face=""Verdana"" Size=""2"">Person submitting this form:
" & "<b>" & theSubmitter & "</b></td>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Title: " & "<b>" & theTitle &
"</b></td></tr>" & vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Date: <b> " & Thetoday & "</b>" &
vbCrLf _

& "<td> <font face=""Verdana"" Size=""2"">Location: <b> " & TheLocation &
"</b>" & vbCrLf _

& "<tr> <td colspan=""3""> <font face=""Verdana"" Size=""2"">How can the
above incident be prevented from happening again? " & "<b>" &
ThePreventedNew & "</b></td>" & vbCrLf _

& "</td><tr></table> </body>"

End Sub

'*************** Main Module************************************

Sub btnSendMail_OnClick

Declare_Var

Get_Info

If Page.IsValid() Then


Response.Write ("<font color=""red"">FORM HAS BEEN SENT TO
RIVERSIDE</font>")


myMessage.From = "(e-mail address removed)"

MyMessage.To = "(e-mail address removed);"

myMessage.Subject = "Accident Form"


MyMessage.BodyFormat = MailFormat.Html


myMail.SmtpServer = ""

myMail.Send(myMessage)

frmEmail.Visible = False

UserMessage = "Has Been Sent."


End If

End Sub





</script>

<html>

<head>

<title>ASP.NET Email (HTML Format) Sample</title>

</head>

<body>


<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">

<h3><center><font face="Verdana">Wheeler's Express Accident Report
Form</font></center></h3>



<form method="post" id="frmEmail" runat="server">




<%--____________________________________________________________________________--%>

<%--Section 1--%>

<tr><td colspan="3" bgcolor="maroon" align="center"> <font face="Verdana"
Size="2" color="white"><b> BASIC CLAIM FACTS</b></td></tr>


<td bgcolor="#E9EDF4" colspan="2">

<font face="Verdana" Size="2">

Employee's Name: <asp:textbox id="EmpName" runat=server columns="45"/>

<asp:RequiredFieldValidator id="RequiredFiedlValidator1" display=dynamic
runat="server" Text="The Employee name is required."

ControlToValidate="EmpName"></asp:RequiredFieldValidator>

</td>

<%---------------------------------------------------------------------------%>

<td align="right" valign="top">


<font face="Verdana" Size="2">Home Phone Number

<asp:TextBox id=HomeNumber runat="server"/>


</td></tr>

<%--____________________________________________________________________________--%>

<%--ROW 2--%>


<tr><td colspan="1" valign="center">

<font face="Verdana" Size="2">Date of Injury </font>

<asp:textbox id="DateofAccident" runat=server /></asp:textbox>

<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"

Text="The Date field is required" ControlToValidate="Dateofaccident">

</asp:RequiredFieldValidator>

</td><td colspan="2"><font face="Verdana" Size="2">Time of Injury
<asp:textbox columns="6" id ="am" runat=server/>a.m.

<asp:textbox columns="6" id= "pm" runat = server/> p.m.</td>

</TD>

</tr>



<tr>

<td>

<font face="Verdana" Size="2">Date Employer Notified <asp:textbox
id="Notifydate" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorNotify" runat="server"

Text="This field is required" ControlToValidate="NotifyDate">

</asp:RequiredFieldValidator>


</td>

<td colspan="2"> <font face="Verdana" Size="2"> Did employee die?
<asp:RadioButtonList id="Die" RepeatDirection="Horizontal" Runat=server>

<asp:ListItem><font face="Verdana" Size="2">Yes</asp:ListItem>

<asp:ListItem><font face="Verdana" Size="2">No</asp:ListItem>
</asp:RadioButtonList>

</td></tr>


<tr><td> <font face="Verdana" Size="2"> Has the Injured Employee Lost Days
From Work?

<asp:RadioButtonList id="LostDays" font-name="verdana" font-size="10 pt"
RepeatDirection="Horizontal" Runat=server>

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem> </asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorLostDays"
Display=Dynamic runat="server"

Text="This field is required" ControlToValidate="LostDays">

</asp:RequiredFieldValidator>




<td colspan="3"><font face="Verdana" Size="2">What State did Injury Occur?
<asp:textbox id="StateOfInjury" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorStateofInjury"
Display=Dynamic runat="server"

Text="The State is required" ControlToValidate="StateOfInjury">

</asp:RequiredFieldValidator>

</td></tr>

<%--SECTION3-----------------------------------------------------------------------------------%>

<tr><td colspan="3" bgcolor="maroon" align="center"> <font face="Verdana"
color="white" Size="2"><b> INJURED EMPLOYEE</b></td></tr>

<tr><td colspan="3"> <font face="Verdana" Size="2"> Home address Street
<asp:TextBox id="street" columns="90" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorStreet"
Display=Dynamic runat="server"

Text="The Street is required" ControlToValidate="Street">

</asp:RequiredFieldValidator>

</td></tr>

<tr><td> <font face="Verdana" Size="2"> City <asp:TextBox id="City"
columns="40" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorCity" Display=Dynamic
runat="server"

Text="The City is required" ControlToValidate="City">

</asp:RequiredFieldValidator>

</td><td> <font face="Verdana" Size="2"> State <asp:TextBox
id="AddressState" columns="2" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorADdressState"
Display=Dynamic runat="server"

Text="The State is required" ControlToValidate="AddressState">

</asp:RequiredFieldValidator>


</td> <td> <font face="Verdana" Size="2"> Zip <asp:TextBox id="Zip"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorZip" Display=Dynamic
runat="server"

Text="The Zip field is required" ControlToValidate="Zip">

</asp:RequiredFieldValidator>

</td></tr>

<tr><td> <font face="Verdana" Size="2">Date of Birth: <asp:textbox id=birth
columns="10" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorBirth" Display=Dynamic
runat="server"

Text="This field required" ControlToValidate="Birth">

</asp:RequiredFieldValidator>

</td><td><font face="Verdana" Size="2"> SSN:<asp:textbox id=SSN columns="11"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorSSN" Display=Dynamic
runat="server"

Text="The SSN field is required" ControlToValidate="SSN">

</asp:RequiredFieldValidator>


</td><td><font face="Verdana" Size="2"> Check one<asp:RadioButtonList
id="Sex" RepeatDirection="Horizontal" runat="server">

<asp:ListItem><font face="Verdana" Size="2">Male</asp:ListItem>

<asp:ListItem><font face="Verdana" Size="2">Female</asp:ListItem>
</asp:RadioButtonList>

</td></tr><td colspan="1"><font face="Verdana" Size="2"> Marital Status
<asp:RadiobuttonList id=Marital RepeatDirection="Vertical"

runat=server>

<asp:ListItem> <font face="Verdana" Size="2"> Single </asp:ListItem>

<asp:ListItem><font face="Verdana" Size="2"> Married </asp:ListItem>

<asp:ListItem><font face="Verdana" Size="2"> Widowed </asp:ListItem>

<asp:ListItem><font face="Verdana" Size="2">
Divorced</asp:ListItem></asp:RadioButtonList>

</td><td colspan="2"><font face="Verdana" Size="2"> Phone Number where
Employee can be Contacted: <asp:TextBox id=contactnumber runat=server/>

</td></tr><tr><td colspan="3"> <font face="Verdana" Size="2"> Job
Description - Choose One <Asp:DropDownList id=Job runat=server>

<asp:ListItem Text="Choose One"/>

<asp:ListItem Text="Clerical"/>

<asp:ListItem Text="Driver"/>

<asp:ListItem Text="Door Manufacturing"/>

<asp:ListItem Text="Installed Sales"/>

<asp:ListItem Text="Manager"/>

<asp:ListItem Text="Puller"/>

<asp:ListItem Text="Sales"/>

<asp:ListItem Text="Shop Tech"/>

<asp:ListItem Text="Truss Manufacturing"/>

<asp:ListItem Text="Yard Worker"/>

<asp:ListItem Text="Warehouse Worker"/>

<asp:ListItem Text="Window Manufacturing"/>

</asp:DropDownList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorJob" Display=Dynamic
runat="server"

Text="This field required" ControlToValidate="Job">

</asp:RequiredFieldValidator>


</td></tr><tr><td colspan="2"> <font face="Verdana" Size="2"> Supervisor's
Name <Asp:TextBox id=Supervisor Columns = "40" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorSupervisor"
Display=Dynamic runat="server"

Text="This field required" ControlToValidate="Supervisor">

</asp:RequiredFieldValidator>


</td><td> <font face="Verdana" Size="2">Time Worked Per Week Hours

<asp:TextBox id=hours Columns="1" runat=server/><br>

<asp:RequiredFieldValidator id="RequiredFieldValidatorHours" Display=Dynamic
runat="server"

Text="This field required" ControlToValidate="Hours">

</asp:RequiredFieldValidator>

<font face="Verdana" Size="2">Days &nbsp<Asp:TextBox id=Days columns="1"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorDays" Display=Dynamic
runat="server"

Text="This field required" ControlToValidate="Days">

</asp:RequiredFieldValidator>


<tr><td colspan="3" bgcolor="MAROON" align="center"> <font face="Verdana"
Size="2" COLOR="WHITE"><b> INJURY OR ILLNESS</b></td></tr>

</td></tr> <tr><td colspan="3"><font face="Verdana" Size="2"> Which part of
the Body Was Injured? (If leg, hand or arm, specify left or right. If
finger, specify which)

<asp:textbox id="part" columns = "40" runat = server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorPart" Display=Dynamic
runat="server"

Text="This field required" ControlToValidate="Part">

</asp:RequiredFieldValidator>

</td></tr> <tr><td colspan="3">

<font face="Verdana" Size="2"> What was the Nature of the Injury? - Choose
one

<asp:DropDownList id="nature" runat=server>

<asp:ListItem Text="Choose One"/>

<asp:ListItem Text="Abdominal Strain"/>

<asp:ListItem Text="Ankle Sprain"/>

<asp:ListItem Text="Back Strain"/>

<asp:ListItem Text="Arm Strain"/>

<asp:ListItem Text="Contusion"/>

<asp:ListItem Text="Embedded Foreign Object"/>

<asp:ListItem Text="Foot Fracture"/>

<asp:ListItem Text="Foreign substance in eye"/>

<asp:ListItem Text="Hand/Finger Fracture"/>

<asp:ListItem Text="Hand/Finger Smash"/>

<asp:ListItem Text="Laceration"/>

<asp:ListItem Text="Leg Fracture"/>

<asp:ListItem Text="Puncture Wound"/>

<asp:ListItem Text="Repetitive Motion Injury"/>

<asp:ListItem Text="Shoulder Strain"/>

<asp:ListItem Text="Struck By Lumber"/>

<asp:ListItem Text="Torn Tendon"/>

<asp:ListItem Text="Other"/>

</asp:DropDownList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorNature" runat="server"

Text="You must answer this question" ControlToValidate="nature">

</asp:RequiredFieldValidator>

</td></tr><tr><td colspan="3" valign="center">

<font face="Verdana" Size="2"> Injury/Illness Description:

<asp:textbox TextMode="MultiLine" Rows="2" columns= "65" id="Description"
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorDescrip"
runat="server"

Text="You must answer this question" ControlToValidate="Description">

</asp:RequiredFieldValidator>

</td></tr><tr><td><font face="Verdana" Size="2"> Initial Medical Treatment:

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=Initial
runat="server">

<asp:ListItem>ER Treated & Released</asp:ListItem>

<asp:ListItem>Hospitalized less than 24 hours</asp:ListItem>

<asp:ListItem>Hospitalized more than 24 hours</asp:ListItem>

<asp:ListItem>Physician/Clinic</asp:ListItem>

<asp:ListItem>Minor/Onsite</asp:ListItem>

<asp:ListItem>None</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorInitial"
runat="server"

Text="You must answer this question" ControlToValidate="Initial">

</asp:RequiredFieldValidator>





</td><td colspan="2" valign="top"><font face="Verdana" Size="2"> What Type
of Medical Provider Performed Treatment?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=Provider
runat="server">

<asp:ListItem>Hospital</asp:ListItem>

<asp:ListItem>Clinic</asp:ListItem>

<asp:ListItem>Physician</asp:ListItem>


</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorProvider"
runat="server"

Text="You must answer this question" ControlToValidate="Provider">

</asp:RequiredFieldValidator>

<br>

<font face="Verdana" Size="2"> Was Employee admitted into a Hospital?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=Admitted
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorAdmitted"
runat="server"

Text="You must answer this question" ControlToValidate="Admitted">

</asp:RequiredFieldValidator>

</td></tr><tr><td colspan="3"><font face="Verdana" Size="2">Medical
Provider - Name:

<asp:TextBox Columns = "65" id=ProviderName runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorProviderName"
runat="server"

Text="You must answer this question" ControlToValidate="ProviderName">

</asp:RequiredFieldValidator>

</td></tr><tr><td colspan="3"><font face="Verdana" Size="2">Medical
Provider - Address:

<asp:TextBox Columns = "65" id=ProviderStreet runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorProviderStreet"
runat="server"

Text="You must answer this question" ControlToValidate="ProviderStreet">

</asp:RequiredFieldValidator>

</td></tr><tr><td colspan="3"><font face="Verdana" Size="2">Medical
Provider - City State Zip:

<asp:TextBox Columns = "65" id=ProviderCity runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorProviderCity"
runat="server"

Text="You must answer this question" ControlToValidate="ProviderCity">

</asp:RequiredFieldValidator>

</td></tr><tr><td colspan="3"><font face="Verdana" Size="2">Medical
Provider - Phone:

<asp:TextBox id=ProviderPhone runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorProviderPhone"
runat="server"

Text="You must answer this question" ControlToValidate="ProviderPhone">

</asp:RequiredFieldValidator>





</td></tr>

<tr><td colspan="3" bgcolor="MAROON" align="center"> <font face="Verdana"
Size="2" COLOR="WHITE"><strong>ACCIDENT DETAILS</strong></td></tr>

</td></tr>

<tr><td colspan="3"> <font face="Verdana" Size="2"> Give a Full Description
of the Accident:<font Size="1"> (Be as Complete as Possible)

<asp:TextBox TextMode="MultiLine" Rows="5" columns= "85" id=Full
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorFull" runat="server"

Text="You must answer this question" ControlToValidate="Full">

</asp:RequiredFieldValidator>

</td></tr> <tr><td colspan="3"><font face="Verdana" Size="2"> What Caused
the Injury?

<asp:TextBox id= caused columns="85" runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorCaused" runat="server"

Text="You must answer this question" ControlToValidate="Caused">

</asp:RequiredFieldValidator>

</td></tr> <tr><td><font face="Verdana" Size="2">Did the Accident Occur at
the Store or Plant?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=Occur
runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorOccur" runat="server"

Text="You must answer this question" ControlToValidate="Occur">

</asp:RequiredFieldValidator>

</td><td colspan="2" valign="top"> <font face="Verdana" Size="2"> If No,
where did the accident occur?

<asp:textBox Columns = "40" id=where runat=server/>

</td></tr> <tr><td><font face="Verdana" Size="2"> Accident Address:

<font face="Verdana" Size="2"> <br> Street <asp:TextBox columns="45"
id=accidentStreet runat=server/>

<br><asp:RequiredFieldValidator id="RequiredFieldValidatorAccidentStreet"
Display=Dynamic runat="server"

Text="Fill this in" ControlToValidate="AccidentStreet">

</asp:RequiredFieldValidator>

</td><td><font face="Verdana" Size="2"> City
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
State <br><asp:TextBox columns="20" id = AccidentCity runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorAccidentCity"
display=dynamic runat="server"

Text="Fill in this field" ControlToValidate="AccidentCity">

</asp:RequiredFieldValidator>

<font face="Verdana" Size="2"> <asp:TextBox columns="2" id=AccidentState
runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorAccidentState"
Display=Dynamic runat="server"

Text="You must fill in this field" ControlToValidate="AccidentState">

</asp:RequiredFieldValidator>

</td><td>

<font face="Verdana" Size="2">Zip <br><asp:TextBox columns = "10"
id=AccidentZip runat=server/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorAccidentZip"
Display=Dynamic runat="server"

Text="You must fill in this field" ControlToValidate="AccidentZip">

</asp:RequiredFieldValidator>



</td></tr> <tr><td valign="top"><font face="Verdana" Size="2"> Are Other WC
Claims Involved?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=OtherClaims
RepeatDirection="Horizontal" Display=dynamic runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorOtherClaims"
runat="server"

Text="Required" ControlToValidate="OtherClaims">

</asp:RequiredFieldValidator>

</td><td Valign="top"><font face="Verdana" Size="2"> Safety Devices
Provided?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=SafetyDevices
RepeatDirection="horizontal" Display=dynamic runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorSafetyDevices"
Display=dynamic runat="server"

Text="Required" ControlToValidate="SafetyDevices">

</asp:RequiredFieldValidator>

</td><td><font face="Verdana" Size="2"> Safety Devices Utilized?

<asp:RadioButtonList font-name="verdana" font-size="10 pt"
id=DevicesUtilized RepeatDirection="Horizontal" runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorDevicesUtilized"
Display=dynamic runat="server"

Text="Required" ControlToValidate="DevicesUtilized">

</asp:RequiredFieldValidator>

</td></tr><tr><td><font face="Verdana" Size="2"> Was There a Witness?

<asp:RadioButtonList font-name="verdana" font-size="10 pt" id=Witness
RepeatDirection="Horizontal" Display=dynamic runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorWitness"
runat="server"

Text="You must answer this question" ControlToValidate="Witness">

</asp:RequiredFieldValidator>

</td><td valign = "top"><font face="Verdana" Size="2">

If Yes, List Name: <asp:Textbox id="WitnessName" columns="40" runat=server/>

</td></tr>

<tr><td colspan="3" bgcolor="MAROON" align="center">

<font face="Verdana" Size="2" COLOR="WHITE"><strong>DISABILITY
STATUS</strong></td></tr>

</td><td colspan="3"><font face="Verdana" Size="2"> Did Employee Receive Pay
for Date of Injury?

<asp:RadioButtonList RepeatDirection="Horizontal" font-name="verdana"
font-size="10 pt" id=ReceivePay runat="server">

<asp:ListItem>Yes</asp:ListItem>

<asp:ListItem>No</asp:ListItem>

</asp:RadioButtonList>

<asp:RequiredFieldValidator id="RequiredFieldValidatorReceivePay"
runat="server"

Text="You must answer this question" ControlToValidate="ReceivePay">

</asp:RequiredFieldValidator>

</td></tr>

<tr><td colspan="3" bgcolor="MAROON" align="center">

<font face="Verdana" Size="2" COLOR="WHITE"><strong>ADDITIONAL COMMENTS &
INFORMATION</strong></td></tr>

<tr><td colspan="3"><font face="Verdana" Size="2"> Additional Comments

<asp:textbox TextMode= "Multiline" Rows= "5" columns= "80"

id="comments" runat=server width="730" height="40"/>

</td></tr>

<tr><td colspan="3"><font face="Verdana" Size="2">How can the above incident
be prevented from happening again?

<asp:textbox id=Prevented Textmode="Multiline" Rows = "3" Columns="80"
width="730" runat=server/>

<tr><td><font face="Verdana" Size="2"><br> Name of person submitting this
form:

<asp:textbox id="Submitter" valign="top" runat=server columns="40"/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorSubmit" runat="server"

Text="You must enter name" ControlToValidate="Submitter">

</asp:RequiredFieldValidator>

<font face="Verdana" Size="2"><br>Title: <asp:textbox id="Title"
valign="top" runat=server columns="40"/>

</td><td> <font face="Verdana" Size="2"> Wheeler's Division - Choose One
<Asp:DropDownList id=Location runat=server>

<asp:ListItem Text="Choose One"/>

<asp:ListItem Text="Riverside Truss Plant"/>

<asp:ListItem Text="Riverside Door Plant"/>

<asp:ListItem Text="Riverside Office"/>

<asp:ListItem Text="Rome Store"/>

<asp:ListItem Text="Calhoun Store"/>

<asp:ListItem Text="Dalton Store"/>

<asp:ListItem Text="Austell Store"/>

<asp:ListItem Text="Morrow Store"/>

<asp:ListItem Text="Installed Sales"/>

<asp:ListItem Text="Newnan Store"/>

<asp:ListItem Text="Cartersville Store"/>

<asp:ListItem Text="Winder Store"/>

<asp:ListItem Text="Jasper Store"/>

<asp:ListItem Text="Chelsea Store"/>

<asp:ListItem Text="Madison Store"/>

<asp:ListItem Text="Peterson Products"/>

<asp:ListItem Text="Lawrenceville"/>

<asp:ListItem Text="OAR Window Shop"/>

<asp:ListItem Text="Charlotte - Hoskins Rd"/>

<asp:ListItem Text="Charlotte - Westinghouse Blvd"/>

<asp:ListItem Text="Sales Support Center"/>

<asp:ListItem Text="Land Development"/>

</asp:DropDownList>


</td><td><br>

<font face="Verdana" Size="2">Date<br><asp:textbox id="Today" runat=server
columns="10"/>

<asp:RequiredFieldValidator id="RequiredFieldValidatorToday" runat="server"

Text="You must enter today's date" ControlToValidate="Today">

</asp:RequiredFieldValidator>





</Table>




<tr>

<td>

<asp:Button id="btnSendMail" text="Submit" OnClick="SendMailandDatabase"
runat="server" />

</td>

</tr>

<td valign=top> <table cellpadding=20><tr><td>

<asp:ValidationSummary ID="valSum" runat="server" ShowMessageBox="true"
ShowSummary="false" HeaderText="You must enter more information"
Font-Name="verdana" Font-Size="12" /> </td>



</form>





</body>

</html>
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

dancer said:
Using ASP.net 1.1 and VB

Is it possible to declare variables in their own subroutine?

I had my DIM statements within a sub that worked just fine.
I wanted to be able to use them in another sub, so I isolated them in their
own subroutine.
But when I call that subroutine within another sub and then try to use those
variables, it does not remember that they have been declared. I get the
message, "Name is not declared."

When I have those same variables declared in the exact same way WITHIN the
second sub it works fine.

When you declare variables inside a method, they are local to the
method. The memory for the variable is allocated on the stack when the
method is called, and the stack pointer is restored when the method
ends, so the variables doesn't exist in any way outside the method.
 
D

dancer

Should I declare the variables again in each subroutine I want to use them
in?
There are 59 variables.

Thanks
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

dancer said:
Should I declare the variables again in each subroutine I want to use them
in?
There are 59 variables.

Thanks

That depends on what you want to do.

If you declare two variables with the same name in separate methods,
they are separate variables and have nothing to do with each other. If
you want to use the variables to share data between methods, you have to
declare them as members in a class.
 
D

dancer

How do I "declare them as members in a class"?
I tried declaring them outside my subroutines, thinking they would be
global. But the subroutine still did not recognize them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top