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

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

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

adding numbers into a table

Status
Not open for further replies.

Jerred

MIS
Mar 1, 2005
3
0
0
US
im new to vb.net and have a question.
im making a form where the user inputs the month and year as integers. i then display the calendar month in the table. i know how to get all the info such as what day of the week the first of the desired month starts on, i just dont know how to add the days into the table PLEASE HELP!!

<%@ Page Language="VB" %>
<script runat="server">

sub page_load

dim strmonth as string
dim stryear as string
dim intmonth as integer
dim intyear as integer
dim mydate as date
dim strdate as string
dim thedate as date
Dim MyWeekDay As Integer
dim name as string
dim nextmonth as integer
dim strnextdate as string
dim thenextdate as date
dim daysinmonth as integer

if Page.IsPostBack then

strmonth = txtmonth.text
intmonth = cint(strmonth)
stryear = txtyear.text
intyear = cint(stryear)
strdate = intmonth & "/01/" & intyear
txttest.text = strdate
thedate = cdate(strdate) 'thedate is desired month in date form on the first month/01/year
MyWeekDay = Weekday(thedate)
name = MonthName(Month(thedate)) 'returns name of month
lblmonth.text = name & " " & intyear
nextmonth = intmonth + 1
strnextdate = nextmonth & "/01/" & intyear
thenextdate = cdate(strnextdate)
daysinmonth = DateDiff(DateInterval.Day, thedate, thenextdate) 'gets number of days in desired month


end if

end sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
Input month as number:
<asp:TextBox id="txtMonth" runat="server"></asp:TextBox>
</p>
<p>
Input year as number:&nbsp;&nbsp; &nbsp;<asp:TextBox id="txtYear" runat="server"></asp:TextBox>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
<input type="submit" value="Submit" />
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
<asp:TextBox id="txttest" runat="server" Visible="False"></asp:TextBox>
</p>
<p>
<asp:Label id="lblmonth" runat="server" width="589px"></asp:Label>
</p>
<table cellspacing="1" cellpadding="7" width="590" border="1">
<tbody>
<tr>
<td width="14%">
<font size="2">S</font></td>
<td width="14%">
<font size="2">M</font></td>
<td width="14%">
<font size="2">T</font></td>
<td width="14%">
<font size="2">W</font></td>
<td width="14%">
<font size="2">T</font></td>
<td width="14%">
<font size="2">F</font></td>
<td width="14%">
<font size="2">S</font></td>
</tr>
<tr>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
<font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
</tr>
<tr>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
<font size="2">&nbsp;</font></td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
<td width="14%">
&nbsp;</td>
</tr>
</tbody>
</table>
<p>
</p>

</form>
</body>
</html>

thanks so much,
Jerred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top