Codeaddict7423
asked on
vb.net sub to have checkbox populate textbox in a user control
Hello,
I would like help with a sub (vb.net) so that when a user clicks on a checkbox, an associated textbox gets populated with a text string like "April 23, 2010"
I would like help with a sub (vb.net) so that when a user clicks on a checkbox, an associated textbox gets populated with a text string like "April 23, 2010"
Make sure the checkbox has the property autopostback set to true, so the change is picked up when the check box is ticked.
If you want the date of when it is clicked, you can use the above code written by Pacmaker but have textbox1.text= now()
If you want the date of when it is clicked, you can use the above code written by Pacmaker but have textbox1.text= now()
ASKER
thank you,
When I applied your suggestion, Visual Studio indicates the following: "Handles clause requires a WithEvents variable..."
Please help.
When I applied your suggestion, Visual Studio indicates the following: "Handles clause requires a WithEvents variable..."
Please help.
Using vb.net at the top of the code page you have 2 drop downs, set the left one to your checkbox and the right one to the CheckBox1_CheckedChanged. It will automatically add a handles on to the end of the subname.
for example
Handles CheckBox1.CheckedChanged
for example
Handles CheckBox1.CheckedChanged
ASKER
PaceMaker9007,
Thank you. At implementing your suggestion, VisualStudio2005 is i ndicating CheckBox1 is being used before it's assigned a value.
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
Please help...
Thank you. At implementing your suggestion, VisualStudio2005 is i ndicating CheckBox1 is being used before it's assigned a value.
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
Please help...
ASKER
Lotok:,
Thank you. I did as you suggested, however, i'm still getting an error indication: Handles clause requires a WithEvents variable." the two dropdowns are selected as "checbox1" and "CheckChanged" do i have to be in a particular control and then assign these two dropdowns?
Thank you. I did as you suggested, however, i'm still getting an error indication: Handles clause requires a WithEvents variable." the two dropdowns are selected as "checbox1" and "CheckChanged" do i have to be in a particular control and then assign these two dropdowns?
When you select the checkbox on the left and checkchanged on the right it will create a SUB in the code page. Just be sure your text is in there.
Can you copy and paste the sub here so I can look for an error?
Can you copy and paste the sub here so I can look for an error?
ASKER
Lotok:
Below, please find my code:
Public Class Form1
Private Sub CheckBox1_CheckedChanged(B yVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Dim TextBox1 As New TextBox
Dim CheckBox1 As CheckBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
End Class
-----------------
Handles CheckBox1.CheckedChanged --------indicates "handle clause requires a WithEvents...
If CheckBox1.Checked = True Then --------indicates variable checkbox1 is used before it has been assigned a value
----------------
Please please help...
Below, please find my code:
Public Class Form1
Private Sub CheckBox1_CheckedChanged(B
Dim TextBox1 As New TextBox
Dim CheckBox1 As CheckBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
End Class
-----------------
Handles CheckBox1.CheckedChanged --------indicates "handle clause requires a WithEvents...
If CheckBox1.Checked = True Then --------indicates variable checkbox1 is used before it has been assigned a value
----------------
Please please help...
ASKER
Lotok:
I have edited my code and it now looks like the following:
Public Class Form1
Protected Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Dim TextBox1 As New TextBox
Dim CheckBox1 As New CheckBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
End Class
---------
VisualBasic indicates the only error as:
Handles CheckBox1.CheckedChanged --------indicates "handle clause requires a WithEvents...
I have edited my code and it now looks like the following:
Public Class Form1
Protected Sub CheckBox1_CheckedChanged(B
Dim TextBox1 As New TextBox
Dim CheckBox1 As New CheckBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
End Class
---------
VisualBasic indicates the only error as:
Handles CheckBox1.CheckedChanged --------indicates "handle clause requires a WithEvents...
The first piece of code in the codebox is the Sub syntax which appears to match yours, unless you are using raiseevent somewhere, that error doesnt really make sense...
Create a new clean form, drop on a checkbox and create a checkedchanged sub as decribed above, does the error appear there?
You shouldnt have to do the line
dim checkbox1 as checkbox
If there is already a checkbox on the form, same with the textbox if it already exists on the form. You just need these lines
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
Create a new clean form, drop on a checkbox and create a checkedchanged sub as decribed above, does the error appear there?
You shouldnt have to do the line
dim checkbox1 as checkbox
If there is already a checkbox on the form, same with the textbox if it already exists on the form. You just need these lines
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
End Sub
ASKER
Lotok,
thanks for the quick reply. The form I'm editing is a user control *.ascx) using VB.NET 2.0.
The form's name is as follows: <HGACServerControls:RSVPFo rm ID="RSVPForm1" runat="server" >
If i comment out "Dim CheckBox1 as New CheckBox", VS indicates "Name CheckBox1 is not declared". The same for "TextBox1",
All I'm trying to do is to get a date on a textbox when a user clicks on a checkbox. this textbox should display "April 23, 2010" to indicate their choice for an event. there is one other date, but I just want one to work, then i'll copy the other function...
thanks for the quick reply. The form I'm editing is a user control *.ascx) using VB.NET 2.0.
The form's name is as follows: <HGACServerControls:RSVPFo
If i comment out "Dim CheckBox1 as New CheckBox", VS indicates "Name CheckBox1 is not declared". The same for "TextBox1",
All I'm trying to do is to get a date on a textbox when a user clicks on a checkbox. this textbox should display "April 23, 2010" to indicate their choice for an event. there is one other date, but I just want one to work, then i'll copy the other function...
On the user control, have you dropped a textbox and checkbox on using the designer? If not then do so.
Remember to do this on the usercontrol, not the form.
The user control is later dropped onto the form which will add the control/code.
Make sure you are using the code behind file for the user control and not for the form.
Remember to do this on the usercontrol, not the form.
The user control is later dropped onto the form which will add the control/code.
Make sure you are using the code behind file for the user control and not for the form.
ASKER
Lotok:
Thank you. I did as youi suggested. I attempted to run the file and got this:
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Private Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Line 22: If CheckBox1.Checked = True Then
Line 23: TextBox1.Text = "April 23, 2010"
Thank you. I did as youi suggested. I attempted to run the file and got this:
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Private Sub CheckBox1_CheckedChanged(B
Line 22: If CheckBox1.Checked = True Then
Line 23: TextBox1.Text = "April 23, 2010"
ASKER
Lotok:
Perhaps this provides a better idea of what i have:
-------------------------- -------
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
End Sub
Private Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
--------------------
Perhaps this provides a better idea of what i have:
--------------------------
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
End Sub
Private Sub CheckBox1_CheckedChanged(B
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
--------------------
I have just created the project on my VS2008 and its working fine.
Here is my code
The user control has a textbox and a checkbox dropped on in designer mode.
The form loads the user control in the below code.
If you want to give me an email address, I cam email you the project. EE wont let me upload the file types needed
Here is my code
The user control has a textbox and a checkbox dropped on in designer mode.
The form loads the user control in the below code.
If you want to give me an email address, I cam email you the project. EE wont let me upload the file types needed
ON THE FORM
Public Class Form1
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim x As New UserControl1
Me.Controls.Add(x)
End Sub
End Class
ON THE USER CONTROL
Public Class UserControl1
Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
End Class
Its ASP.NET? AHHHH lol
Do you have your checkbox and textbox in the ASP markup or are you creating them dynamically?
Do you have your checkbox and textbox in the ASP markup or are you creating them dynamically?
Also have you declared the user control on the ASP.NET page?
ASKER
Lotok:
thanks for the quick reply. The checkbox is not generated dynamically. All controls in the UserControl form are structured under servercontrols named "RSVPForm1". under that is a "<AdditionalFormControls>" and then the table with the controls start. this is a usercontrol that gets imported into a CMS called "TeamSite, ver 5.7.1" TeamSite generates the page inside which this usercontrol lives. THe code below may explain what I'm doing:
--------
<%@ Control Language="VB" ClassName="RSVP_FEMAnopay" Debug="true" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
End Sub
Private Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
<div align="center"><p><img title="FEMA Workshops" height="108" alt="FEMA Workshops" hspace="0" src="/community/water/rfmc /images/lo go.gif" width="600" align="middle" border="0" /></p></div>
<p style="font-size: x-small; color: red; text-align: right">
* denotes required fields.<br />
<HGACServerControls:RSVPFo rm ID="RSVPForm1" runat="server" CreditCardOnly="false" RSVPContactEmail="luis.her nandez@h-g ac.com" RSVPCode="FEMA Workshop Registration Form" Width="572px" ShowBilling="false" ShowBillingTotalLabel="fal se" >
<AdditionalFormControls>
-----------------
after this the table with the individual controls start
thanks for the quick reply. The checkbox is not generated dynamically. All controls in the UserControl form are structured under servercontrols named "RSVPForm1". under that is a "<AdditionalFormControls>"
--------
<%@ Control Language="VB" ClassName="RSVP_FEMAnopay"
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
End Sub
Private Sub CheckBox1_CheckedChanged(B
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
<div align="center"><p><img title="FEMA Workshops" height="108" alt="FEMA Workshops" hspace="0" src="/community/water/rfmc
<p style="font-size: x-small; color: red; text-align: right">
* denotes required fields.<br />
<HGACServerControls:RSVPFo
<AdditionalFormControls>
-----------------
after this the table with the individual controls start
I need to get to bed, I will have a look at this for you tomorrow (about 7 hrs time).
I will do as I did when I thought it was a winforms app. Just create the code here and test it.
Hang in there.
I will do as I did when I thought it was a winforms app. Just create the code here and test it.
Hang in there.
Is the checkbox1 located in the table with the individual controls? Could you paste that part of the code as well
If you can post the code including the table and the ASP markup showing the checkbox etc.
If its really big, then just attach it as a file.
If its really big, then just attach it as a file.
ASKER
Lotok:
Hello,
Below, please find my user control file. name: RSVP_FEMAnopay.ascx
-------
<%@ Control Language="VB" ClassName="RSVP_FEMAnopay" Debug="true" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
' dd = RSVPForm1.FindControl("txt _DateOfWor kshop_01")
' dd.Items.Add(New ListItem("April23", " April 23,"))
' dd.Items.Add(New ListItem("May11", " May 11,"))
'End If
End Sub
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
<div align="center"><p><img title="FEMA Workshops" height="108" alt="FEMA Workshops" hspace="0" src="/community/water/rfmc /images/lo go.gif" width="600" align="middle" border="0" /></p></div>
<p style="font-size: x-small; color: red; text-align: right">
* denotes required fields.<br />
<HGACServerControls:RSVPFo rm ID="RSVPForm1" runat="server" CreditCardOnly="false" RSVPContactEmail="luis.her nandez@h-g ac.com" RSVPCode="FEMA Workshop Registration Form" Width="572px" ShowBilling="false" ShowBillingTotalLabel="fal se" >
<AdditionalFormControls>
<table width="620" cellpadding="0" cellspacing="0" style="border-color:blue" border="0">
<tr>
<td colspan="4" style="width:100%" valign="top" align="left"><strong><span style="color:crimson">Cont act Information</span></strong ><br /></td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">   ; </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label2" runat="server" AssociatedControlID="tbFNa me" Text="First Name:"></asp:Label> & nbsp;</td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbFName" runat="server" Width="190px"></asp:TextBo x></span>< /td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 1" runat="server" ControlToValidate="tbFName " Display="Dynamic" ErrorMessage="First Name is required" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator> </td></tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label1" runat="server" AssociatedControlID="tbLNa me" Text="Last Name:"></asp:Label> & nbsp;</td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbLName" runat="server" Width="190px"></asp:TextBo x></span>< /td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 9" runat="server" ControlToValidate="tbLName " Display="Dynamic" ErrorMessage="Last Name is required" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator> </td></tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label6" runat="server" AssociatedControlID="tbTit le" Text="Title:"></asp:Label> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbTitle" runat="server" Width="190px"></asp:TextBo x> </span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label3" runat="server" AssociatedControlID="tbOrg anization" Text="Organization:"></asp :Label>&nb sp; < /td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbOrganization" runat="server" Width="190px"></asp:TextBo x></span>< /td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 2" runat="server" ControlToValidate="tbOrgan ization" ErrorMessage="Organization is required" Display="Dynamic" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator></td ></tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label100" runat="server" AssociatedControlID="tbAdd res" Text="Address:"></asp:Labe l> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbAddres" runat="server" Width="190px"></asp:TextBo x></span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 5" runat="server" ControlToValidate="tbAddre s" ErrorMessage="Address is required" Display="Dynamic" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator></td >
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label8" runat="server" AssociatedControlID="tbCit y" Text="City:"></asp:Label> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbCity" runat="server" Width="190px"></asp:TextBo x> </span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 6" runat="server" ControlToValidate="tbCity" Display="Dynamic" ErrorMessage="City is required" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label9" runat="server" AssociatedControlID="tbSta te" Text="State:"></asp:Label> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbState" runat="server" Width="190px"></asp:TextBo x> </span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 7" runat="server" ControlToValidate="tbState " Display="Dynamic" ErrorMessage="State is required" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label10" runat="server" AssociatedControlID="tbZip " Text="Zip Code:"></asp:Label> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbZip" runat="server" Width="190px"></asp:TextBo x> </span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 8" runat="server" ControlToValidate="tbZip" ErrorMessage="Zip Code is required" Display="Dynamic" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label5" runat="server" AssociatedControlID="tbPho ne" Text="Phone #:"></asp:Label> &nbs p;</td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbPhone" runat="server" Width="190px"></asp:TextBo x></span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 4" runat="server" ControlToValidate="tbPhone " ErrorMessage="Phone is required" Display="Dynamic" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator></td ></tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label11" runat="server" AssociatedControlID="tbCel lPhone" Text="Cell Phone #:"></asp:Label> </td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbCellPhone" runat="server" Width="190px"></asp:TextBo x> </span> </td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label4" runat="server" AssociatedControlID="tbEma il" Text="Email:"></asp:Label> &nbs p;</td>
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbEmail" runat="server" Width="190px"></asp:TextBo x></span>< /td>
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re quiredFiel dValidator ID="RequiredFieldValidator 13" runat="server" ControlToValidate="tbEmail " ErrorMessage="Email is required" Display="Dynamic" EnableClientScript="true" SetFocusOnError="true"></a sp:Require dFieldVali dator>
<asp:RegularExpressionVali dator ID="RegularExpressionValid ator1" runat="server"
ControlToValidate="tbEmail " ValidationExpression="^[a- zA-Z][\w\. -]*[a-zA-Z 0-9]@[a-zA -Z0-9][\w\ .-]*[a-zA- Z0-9]\.[a- zA-Z][a-zA -Z\.]*[a-z A-Z]$" Display="Dynamic" ErrorMessage="Enter Valid e-mail"></asp:RegularExpre ssionValid ator>
</td></tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="left"><strong><span style="color:crimson">Work shop Information</span></strong ><br /> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">   ; </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
<asp:Label ID="lblWorkshop_01" runat="server" AssociatedControlID="Works hop_1">Att end April 23 Workshop:</asp:Label>
</td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox 1_CheckedC hanged" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB ox>
</span>
</td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Wor kshop 1: </span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="color:#4b8a08; font-size:11px">Local Official’s Guide to Coastal Construction</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Dat e: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="color:#08088a; font-size:11px">Friday, April 23, 2010</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Tim e: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">8:0 0 am – 5:00 pm</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Loc ation:&nbs p; </ span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px"><a class="null" title="Directions Community Resource Center" href="http://www.unitedwayhouston.org/default/pdfs/uw_directions.pdf">United Way<br />Community Resource Center</a><br />
50 Waugh Drive<br />
Houston, TX 77007</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Cos t: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">The re is no fee for this workshop.</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">&nb sp; < /span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">&nb sp; </span></td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
<asp:Label ID="lblWorkshop_02" runat="server" AssociatedControlID="Works hop_2">Att end May 11 Workshop:</asp:Label>
</td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan>
<asp:CheckBox ID="Workshop_2" runat="server" AutoPostBack="False" Font-Size= "X-Small" Text=" " /></span> </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Wor kshop 2: </span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="color:#4b8a08; font-size:11px">Coastal Construction Workshop for Homebuilders and <br />
Introduction to Coastal Foundation Design and Construction for Local Officials
</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Dat e: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="color:#08088a; font-size:11px">Tuesday, May 11, 2010</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Tim e: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">8:0 0 am – 5:00 pm</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Loc ation:&nbs p; </ span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px"><a class="null" title="Directions to H-GAC" href="http://www.h-gac.com/contact/Map/default.aspx">Houston-Galveston Area Council</a><br />
3555 Timmons Lane</a><br />
2nd Floor Conference Room A, Suite 120<br />
Houston, TX 77027</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Cos t: &n bsp;</span > </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">The re is no fee for this workshop.</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">&nb sp; < /span> </td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s pan style="font-size:11px">&nb sp; </span></td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">   ; </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"> <asp:Label ID="Label7" runat="server"
Text="Your Comments: " AssociatedControlID="tbCom ments"></a sp:Label>< /td>
<td colspan="3" style="text-align: left; width: 70%"><span>
<asp:TextBox ID="tbComments" runat="server" TextMode="MultiLine" Height="80" Width="90%"></asp:TextBox>
</td>
</tr>
</table>
<br /> <br />
</AdditionalFormControls>
<RSVPResponseText>
<p>
<font face="Arial, Helvetica, sans-serif">
Thank you for registering!<br /> <br />
For more information about the event please contact:
<br />
Erin Livingston<br />
(832) 681-2525<br />
<a href="mailto:erin.livingst on@h-gac.c om">erin.l ivingston@ h-gac.com< /a>.
</font></p>
</RSVPResponseText>
</HGACServerControls:RSVPF orm>
</p>
Hello,
Below, please find my user control file. name: RSVP_FEMAnopay.ascx
-------
<%@ Control Language="VB" ClassName="RSVP_FEMAnopay"
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
' dd = RSVPForm1.FindControl("txt
' dd.Items.Add(New ListItem("April23", " April 23,"))
' dd.Items.Add(New ListItem("May11", " May 11,"))
'End If
End Sub
Public Sub CheckBox1_CheckedChanged(B
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
<div align="center"><p><img title="FEMA Workshops" height="108" alt="FEMA Workshops" hspace="0" src="/community/water/rfmc
<p style="font-size: x-small; color: red; text-align: right">
* denotes required fields.<br />
<HGACServerControls:RSVPFo
<AdditionalFormControls>
<table width="620" cellpadding="0" cellspacing="0" style="border-color:blue" border="0">
<tr>
<td colspan="4" style="width:100%" valign="top" align="left"><strong><span
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">  
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label2" runat="server" AssociatedControlID="tbFNa
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbFName" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label1" runat="server" AssociatedControlID="tbLNa
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbLName" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label6" runat="server" AssociatedControlID="tbTit
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbTitle" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label3" runat="server" AssociatedControlID="tbOrg
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbOrganization" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label100" runat="server" AssociatedControlID="tbAdd
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbAddres" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label8" runat="server" AssociatedControlID="tbCit
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbCity" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label9" runat="server" AssociatedControlID="tbSta
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbState" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label10" runat="server" AssociatedControlID="tbZip
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbZip" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label5" runat="server" AssociatedControlID="tbPho
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbPhone" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label11" runat="server" AssociatedControlID="tbCel
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbCellPhone" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"> </td>
</tr>
<tr>
<td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label4" runat="server" AssociatedControlID="tbEma
<td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbEmail" runat="server" Width="190px"></asp:TextBo
<td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color: red">*</span> <asp:Re
<asp:RegularExpressionVali
ControlToValidate="tbEmail
</td></tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="left"><strong><span
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">  
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
<asp:Label ID="lblWorkshop_01" runat="server" AssociatedControlID="Works
</td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox
<asp:TextBox ID="TextBox1" runat="server"></asp:TextB
</span>
</td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Wor
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Dat
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Tim
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Loc
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
50 Waugh Drive<br />
Houston, TX 77007</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Cos
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">&nb
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
<asp:Label ID="lblWorkshop_02" runat="server" AssociatedControlID="Works
</td>
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
<asp:CheckBox ID="Workshop_2" runat="server" AutoPostBack="False" Font-Size= "X-Small" Text=" " /></span> </td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Wor
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
Introduction to Coastal Foundation Design and Construction for Local Officials
</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Dat
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Tim
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Loc
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
3555 Timmons Lane</a><br />
2nd Floor Conference Room A, Suite 120<br />
Houston, TX 77027</span></td>
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">Cos
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span style="font-size:11px">&nb
<td colspan="3" style="text-align: left; vertical-align:top; width: 70%; background-color:white"><s
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
</tr>
<tr>
<td colspan="4" style="width:100%" valign="top" align="center">  
</tr>
<tr>
<td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"> <asp:Label ID="Label7" runat="server"
Text="Your Comments: " AssociatedControlID="tbCom
<td colspan="3" style="text-align: left; width: 70%"><span>
<asp:TextBox ID="tbComments" runat="server" TextMode="MultiLine" Height="80" Width="90%"></asp:TextBox>
</td>
</tr>
</table>
<br /> <br />
</AdditionalFormControls>
<RSVPResponseText>
<p>
<font face="Arial, Helvetica, sans-serif">
Thank you for registering!<br /> <br />
For more information about the event please contact:
<br />
Erin Livingston<br />
(832) 681-2525<br />
<a href="mailto:erin.livingst
</font></p>
</RSVPResponseText>
</HGACServerControls:RSVPF
</p>
In the part where you have your checkbox, try to remove this:
OnCheckedChanged="CheckBox 1_CheckedC hanged"
see if it helps.
OnCheckedChanged="CheckBox
see if it helps.
ASKER
I did that. i'm still getting the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Source Error:
Line 22:
Line 23:
Line 24: Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Line 25:
Line 26: If CheckBox1.Checked = True Then
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Source Error:
Line 22:
Line 23:
Line 24: Public Sub CheckBox1_CheckedChanged(B
Line 25:
Line 26: If CheckBox1.Checked = True Then
Ok, please return back the OnCheckedChanged="CheckBox 1_CheckedC hanged", but remove the Handles Checkbox1.CheckedChanged.
ASKER
Ok, now i'm getting a simple error about declaring:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'CheckBox1' is not declared.
Source Error:
Line 24: Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs)
Line 25:
Line 26: If CheckBox1.Checked = True Then
Line 27: TextBox1.Text = "April 23, 2010"
Line 28: Else
---------
below is my sub syntax:
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs)
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'CheckBox1' is not declared.
Source Error:
Line 24: Public Sub CheckBox1_CheckedChanged(B
Line 25:
Line 26: If CheckBox1.Checked = True Then
Line 27: TextBox1.Text = "April 23, 2010"
Line 28: Else
---------
below is my sub syntax:
Public Sub CheckBox1_CheckedChanged(B
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
ASKER
I got the form to run without returning errors; but it still doesnot work. My sub code is as follows:
--------------
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs)
Dim CheckBox1 As New CheckBox
Dim TextBox1 As New TextBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
----------
--------------
Public Sub CheckBox1_CheckedChanged(B
Dim CheckBox1 As New CheckBox
Dim TextBox1 As New TextBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
----------
ASKER
Hello,
I've edited my sub to read like this:
--------
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles Me.CheckBox1.CheckedChange d
Dim CheckBox1 As New CheckBox
Dim TextBox1 As New TextBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
-------
The line "CheckBox1.CheckedChanged" is indicating a error like "End of Statement Expected"
Please help!!!
I've edited my sub to read like this:
--------
Public Sub CheckBox1_CheckedChanged(B
Dim CheckBox1 As New CheckBox
Dim TextBox1 As New TextBox
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
-------
The line "CheckBox1.CheckedChanged"
Please help!!!
ASKER
Hello,
I'm trying something new, however it's not working, perhaps you can help me.
Sub syntax:
-----------
Public Sub chkchk_checked(ByVal sender As Object, ByVal e As System.EventArgs)
Dim chkchk As CheckBox = CType(sender, CheckBox)
Dim TextBox1 As New TextBox
If chkchk.Checked = True Then
'call your SP
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
-------------
Checkbox code:
-------------
<asp:CheckBox ID="chkchk" runat="server" OnCheckedChanged="chkchk_c hecked" AutoPostBack="true" />
<asp:TextBox ID="TextBox1" runat="server" BackColor="yellow"></asp:T extBox>
<br />
-------------
Please help!
I'm trying something new, however it's not working, perhaps you can help me.
Sub syntax:
-----------
Public Sub chkchk_checked(ByVal sender As Object, ByVal e As System.EventArgs)
Dim chkchk As CheckBox = CType(sender, CheckBox)
Dim TextBox1 As New TextBox
If chkchk.Checked = True Then
'call your SP
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
-------------
Checkbox code:
-------------
<asp:CheckBox ID="chkchk" runat="server" OnCheckedChanged="chkchk_c
<asp:TextBox ID="TextBox1" runat="server" BackColor="yellow"></asp:T
<br />
-------------
Please help!
Try this
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles Me.CheckBox1.CheckedChange d
Dim chk as checkbox = Ctype(Page.findcontrol("ch eckbox1"), checkbox)
Dim txt as textbox = Ctype(Page.findcontrol("te xtbox1"), textbox)
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
Public Sub CheckBox1_CheckedChanged(B
Dim chk as checkbox = Ctype(Page.findcontrol("ch
Dim txt as textbox = Ctype(Page.findcontrol("te
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
ASKER
Thank you. I copied your code and VisualStudio is indicating teh following:
CheckBox1.CheckedChanged (error indicator stating: "End of Statement Expected" )
CheckBox1.CheckedChanged (error indicator stating: "End of Statement Expected" )
double click the error, it will take you to the line in question.
copy and paste that section
copy and paste that section
ASKER
below, please find the compilation error i'm getting:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30590: Event 'CheckBox1' cannot be found.
Source Error:
Line 22:
Line 23:
Line 24: Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles Me.CheckBox1.CheckedChange d
Line 25:
Line 26: Dim chk As CheckBox = CType(Page.FindControl("ch eckbox1"), CheckBox)
Source File: Y:\default\main\www\WORKAR EA\Common\ htdocs\uc\ RSVP\RSVP_ FEMAnopay. ascx Line: 24
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30590: Event 'CheckBox1' cannot be found.
Source Error:
Line 22:
Line 23:
Line 24: Public Sub CheckBox1_CheckedChanged(B
Line 25:
Line 26: Dim chk As CheckBox = CType(Page.FindControl("ch
Source File: Y:\default\main\www\WORKAR
ASKER
Hello, I modified the sub as follows:
Public Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Dim chk As CheckBox = CType(Page.FindControl("Ch eckBox1"), CheckBox)
Dim txt As TextBox = CType(Page.FindControl("Te xtBox1"), TextBox)
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
--------------------
VS is indicating a "Handles requires a 'withEvents' variable"
Please help!!!!!
Public Sub CheckBox1_CheckedChanged(B
Dim chk As CheckBox = CType(Page.FindControl("Ch
Dim txt As TextBox = CType(Page.FindControl("Te
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
--------------------
VS is indicating a "Handles requires a 'withEvents' variable"
Please help!!!!!
ASKER
Hello,
I 've modified the sub as follows:
Private Sub CheckBox1_CheckChanged(ByV al sender As Object, ByVal e As System.EventArgs) Handles CheckBox1_CheckedChanged.
Dim chk As CheckBox = CType(Page.FindControl("Ch eckBox1"), CheckBox)
Dim txt As TextBox = CType(Page.FindControl("Te xtBox1"), TextBox)
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
------------------
VS is indicating an error at the end of the "CheckBox1_CheckedChanged. " as "identifyer expected"
copiler eror as follows:
BC30287: '.' expected.
I 've modified the sub as follows:
Private Sub CheckBox1_CheckChanged(ByV
Dim chk As CheckBox = CType(Page.FindControl("Ch
Dim txt As TextBox = CType(Page.FindControl("Te
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
------------------
VS is indicating an error at the end of the "CheckBox1_CheckedChanged.
copiler eror as follows:
BC30287: '.' expected.
OK so I can be very clear. I want to make sure I am clear before i recreate the ASP.NET scenario here.
You need to have a usercontrol, which contains a table. It is not a table control, just a standard XHTML table. Within that, you will have a checkbox and a textbox.
You want the checkbox to autopost back, so when checked it shows a date and then unchecked it clears.
That about right?
You need to have a usercontrol, which contains a table. It is not a table control, just a standard XHTML table. Within that, you will have a checkbox and a textbox.
You want the checkbox to autopost back, so when checked it shows a date and then unchecked it clears.
That about right?
ASKER
Lotok,
thanks for the quick reply. Yes, I have a user control. in that user control there is a script as follows:
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
' dd = RSVPForm1.FindControl("txt _DateOfWor kshop_01"
'End If
End Sub
Private Sub CheckBox1_CheckChanged(ByV al sender As Object, ByVal e As System.EventArgs) Handles CheckBox1_CheckedChanged
Dim chk As CheckBox = CType(RSVPForm1.FindContro l("CheckBo x1"), CheckBox)
Dim txt As TextBox = CType(RSVPForm1.FindContro l("TextBox 1"), TextBox)
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
</script>
After this script, there is a form declaration as follows:
<HGACServerControls:RSVPFo rm ID="RSVPForm1" runat="server" CreditCardOnly="false" RSVPContactEmail="luis.her nandez@h-g ac.com" RSVPCode="FEMA Workshop Registration Form" Width="572px" ShowBilling="false" ShowBillingTotalLabel="fal se" >
<AdditionalFormControls>
Now there is a table with rows and cells. in one of those cells, there is a checkbox control (CheckBox1) and a TextBox control (TextBox1).
I am attempting to write code such that when a user clicks on the checkbox control (CheckBox1) TextBox1 control displays a text string ("April23, 2010") and when the user unclicks the checkbox control, the textbox control (TextBox1) clears.
My code is as follows:
Private Sub CheckBox1_CheckChanged(ByV al sender As Object, ByVal e As System.EventArgs) Handles CheckBox1_CheckedChanged
Dim chk As CheckBox = CType(RSVPForm1.FindContro l("CheckBo x1"), CheckBox)
Dim txt As TextBox = CType(RSVPForm1.FindContro l("TextBox 1"), TextBox)
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
VS indicates that there is a missing (.) at the end of "CheckBox1_CheckedChanged" when i add it , i get an indication that "an identifier is expected"...
When i run t his code, i get the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30203: Identifier expected.
Source Error:
Line 18: End Sub
Line 19:
Line 20: Private Sub CheckBox1_CheckChanged(ByV al sender As Object, ByVal e As System.EventArgs) Handles CheckBox1_CheckedChanged.
Line 21:
Line 22: Dim chk As CheckBox = CType(RSVPForm1.FindContro l("CheckBo x1"), CheckBox)
Source File: Y:\default\main\www\WORKAR EA\Common\ htdocs\uc\ RSVP\RSVP_ FEMAnopay. ascx Line: 20
--------
Please help!!!
thanks for the quick reply. Yes, I have a user control. in that user control there is a script as follows:
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'If (Not IsPostBack) Then
' dd = RSVPForm1.FindControl("txt
'End If
End Sub
Private Sub CheckBox1_CheckChanged(ByV
Dim chk As CheckBox = CType(RSVPForm1.FindContro
Dim txt As TextBox = CType(RSVPForm1.FindContro
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
</script>
After this script, there is a form declaration as follows:
<HGACServerControls:RSVPFo
<AdditionalFormControls>
Now there is a table with rows and cells. in one of those cells, there is a checkbox control (CheckBox1) and a TextBox control (TextBox1).
I am attempting to write code such that when a user clicks on the checkbox control (CheckBox1) TextBox1 control displays a text string ("April23, 2010") and when the user unclicks the checkbox control, the textbox control (TextBox1) clears.
My code is as follows:
Private Sub CheckBox1_CheckChanged(ByV
Dim chk As CheckBox = CType(RSVPForm1.FindContro
Dim txt As TextBox = CType(RSVPForm1.FindContro
If chk.Checked = True Then
txt.Text = "April 23, 2010"
Else
txt.Text = ""
End If
End Sub
VS indicates that there is a missing (.) at the end of "CheckBox1_CheckedChanged"
When i run t his code, i get the following error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30203: Identifier expected.
Source Error:
Line 18: End Sub
Line 19:
Line 20: Private Sub CheckBox1_CheckChanged(ByV
Line 21:
Line 22: Dim chk As CheckBox = CType(RSVPForm1.FindContro
Source File: Y:\default\main\www\WORKAR
--------
Please help!!!
OK, So I have created an ASP.NET usercontrol named UserControl2. That control contains a table with the checkbox and textbox. I have placed the user control on a aspx page to test and it works fine.
Now you will see I excluded the form declaration.
<HGACServerControls:RSVPFo rm ID="RSVPForm1" runat="server" CreditCardOnly="false" RSVPContactEmail="luis.her nandez@h-g ac.com" RSVPCode="FEMA Workshop Registration Form" Width="572px" ShowBilling="false" ShowBillingTotalLabel="fal se" >
<AdditionalFormControls>
What is the HGACServer controls, something you wrote? or someone elses code?
Now as I said, the below code work.
If you create a similar test at your end it will help you troubleshoot.
Please follow these steps.
1) Create a user control.
2) Paste the code from CODE SAMPLE 1 into that control.
3) Drop the control on an aspx page in designer mode.
4) you will see dropping the control on creates 2 new lines of markup on the aspx page, similar to code sample 2
Confirm you have that working then we can take it from there.
Now you will see I excluded the form declaration.
<HGACServerControls:RSVPFo
<AdditionalFormControls>
What is the HGACServer controls, something you wrote? or someone elses code?
Now as I said, the below code work.
If you create a similar test at your end it will help you troubleshoot.
Please follow these steps.
1) Create a user control.
2) Paste the code from CODE SAMPLE 1 into that control.
3) Drop the control on an aspx page in designer mode.
4) you will see dropping the control on creates 2 new lines of markup on the aspx page, similar to code sample 2
Confirm you have that working then we can take it from there.
CODE SAMPLE 1*********************
**********************************
<script runat="server">
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
<table>
<tr>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</tr>
<tr>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
</tr>
</table>
CODE SAMPLE 2********************
*********************************
<%@ Register src="UserControl2.ascx" tagname="UserControl2" tagprefix="uc1" %>
<uc1:UserControl2 ID="UserControl21" runat="server" />
ASKER
Lotok,
thank you for your help. i have done the steps you suggested.
When i add the code block:
<script runat="server">
Protected Sub CheckBox1_CheckedChanged(B yVal sender As Object, ByVal e As System.EventArgs)
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
VS is indicating the following: CheckBox1 is not declared and TextBox1 is not declared
In the past, I've fixed this by declaring: Dim CheckBox1 as New Checkbox and
Dim TextBox1 as New Textbox
that seems to make VS happy. should I do that now?
thank you for your help. i have done the steps you suggested.
When i add the code block:
<script runat="server">
Protected Sub CheckBox1_CheckedChanged(B
If CheckBox1.Checked = True Then
TextBox1.Text = "April 23, 2010"
Else
TextBox1.Text = ""
End If
End Sub
</script>
VS is indicating the following: CheckBox1 is not declared and TextBox1 is not declared
In the past, I've fixed this by declaring: Dim CheckBox1 as New Checkbox and
Dim TextBox1 as New Textbox
that seems to make VS happy. should I do that now?
No, below that code block on my example is some markup (below). That is where the controls are declared.
can you paste your full page of code/markup once you complete this as a comparison? From your previous posts I see you dont use a seperate code page, I have allowed for that in my example, it all belongs on 1 page.
can you paste your full page of code/markup once you complete this as a comparison? From your previous posts I see you dont use a seperate code page, I have allowed for that in my example, it all belongs on 1 page.
<table>
<tr>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</tr>
<tr>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
</tr>
</table>
ASKER
it worked...let me try it on the actual form....
ASKER
It works on the actual form. now for tweaking the look and feel, but at least, the code works. THANK YOU SO VERY MUCH!!!
No probs, glad I could help.
We got there eventually :D
We got there eventually :D
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window