ChrisPadgham 113 Posting Whiz

You can use the Format$ function to pick out individual bits of a date, see code below.

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        TextBox1.Text = Format$(Calendar1.SelectedDate, "dd")
        TextBox2.Text = Format$(Calendar1.SelectedDate, "MM")
        TextBox3.Text = Format$(Calendar1.SelectedDate, "yy")
        
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Calendar ID="Calendar1" runat="server" ></asp:Calendar>
    
    </div>
        <asp:Label ID="Label1" runat="server" Text="Day"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" Width="58px"></asp:TextBox>
        <asp:Label ID="Label2" runat="server" Text="Month"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server" Width="61px"></asp:TextBox>
        <asp:Label ID="Label3" runat="server" Text="Year"></asp:Label>
        <asp:TextBox ID="TextBox3" runat="server" Width="47px"></asp:TextBox><br />
        <asp:Button ID="Button1" runat="server" Text="Update" OnClick="Button1_Click" />
    </form>
</body>
</html>