Trying to write a program in ASP.net using Visual Basic.
Getting stuck on the objects.
The tool tip says: “Reference to a non-shared member requires an object reference”.
How do I reference an object of a TextBox1 and DropDownList1 also Button1 need a withevents so I can run my vb code?
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:TextBox ID="TextBox1" runat="server">07</asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>AM</asp:ListItem>
<asp:ListItem>PM</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Button1" /></td>
</asp:Content>
<script runat="server">
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim a1, a2 as Double
a1 = Textbox1.Text
Select Case DropDownList1.Text
Case "AM"
a2 = 0
Case "PM"
a2 = 1
End Select
End Sub
End Class
</script>