AutoWallPaper
It automatically changes the desktop wallpaper after specified time. It converts GIF's and JPEG's to bmp before setting the wall paper. It creates two regsitry entries for the first time. Two entries are Image directory: Path of the directory where all image files resides and Time slice. It also creates a regsitry entry: HKEY_LOCAL_MACHINE/SOFTWARE/AUTOWALLPAPER
AI
Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Código fonte
Upload
<p><b><font face="Verdana" size="2">Web Controls in ASP.NET - The TextBox Control</font></b></p>
<p><font size="2" face="Verdana">One of the most important aspects in developing
dynamics websites is the ability to use form data. In the previous versions
of ASP, form data was collected by using standard HTML tags and parsing it to
some server-side ASP script. In ASP.NET, instead of using HTML code, you can
use Web Controls to produce different form elements in order to create "smart
forms." In this article, I will expose you to the TextBox Control. </font></p>
<p><font size="2" face="Verdana">Unlike the Label Control, the textbox control
has a few more elements to it. Before anything else, let's begin by looking
at the very basic syntax. </font></p>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"
width="80%" id="AutoNumber1" class="normal">
<tr>
<td width="100%" bgcolor="#C0C0C0"><b><u>Code:</u><br>
<asp:TextBox id="<font color="#FF0000">mybox</font>" TextMode="<font color="#FF0000">SingleLine</font>"
Columns="<font color="#FF0000">25</font>" runat="<font
color="#FF0000">server</font>" /></b></td>
</tr>
</table>
</center>
</div>
<p><font size="2" face="Verdana">The example above shows a minimal amount of code
to produce a TextBox. </font></p>
<p><font size="2" face="Verdana">The <strong>id="textbox"</strong> section
is used to give a unique name to this control. Lets say you wanted to reference
this control somewhere else in your application, you would need to call it by
it's name. </font></p>
<p><font size="2" face="Verdana">The <strong>TextMode="SingleLine"</strong>
section is used to determine what kind of textbox it will be. In the example
above, I have decided to make it a single line textbox. Think of the single
line text as the same one generated by the following HTML Tag: <input type="text"
name="something">. Other options for this property include "Password"
and "Multiline." Password generates a password field and multiline
generates a textarea box.</font></p>
<p><font size="2" face="Verdana">The <strong>Columns="25"</strong> sets
the width of the control in characters.</font></p>
<p><strong><font color="#0000FF" size="2" face="Verdana">Possible Properties</font></strong></p>
<p><strong><font color="#000000" size="2" face="Verdana">AutoPostBack - </font></strong><font color="#000000" size="2" face="Verdana">When
set to True, the form is automatically posted back when a change has been made
to it. (<strong>Example:</strong> AutoPostBack="True")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">Columns - </font></strong><font color="#000000" size="2" face="Verdana">Sets
the width of the textbox in characters. (<strong>Example: </strong>Columns="25")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">MaxLength - </font></strong><font color="#000000" size="2" face="Verdana">The
max amount of characters which can be entered into the textbox. (<strong>Example:
</strong>Columns="25")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">ReadOnly - </font></strong><font color="#000000" size="2" face="Verdana">When
True, changes cannot be made to the textbox. (<strong>Example: </strong>ReadOnly="True")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">Rows - </font></strong><font color="#000000" size="2" face="Verdana">Sets
the number of rows for a multilined textbox. Note: You cannot have multilined
password fields. This property would be invalid if used during that circumstance.
(<strong>Example: </strong>Rows="10")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">Text - </font></strong><font color="#000000" size="2" face="Verdana">Sets
or retrieves the text value for the textbox. (<strong>See Examples in this article.</strong>)</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">TextMode - </font></strong><font color="#000000" size="2" face="Verdana">Sets
the type of textbox which will be used. Possible values are: SingleLine, Password,
Multilined. (<strong>Example: </strong>TextMode="SingleLine")</font></p>
<p><strong><font color="#000000" size="2" face="Verdana">Wrap - </font></strong><font color="#000000" size="2" face="Verdana">
Will multilined textboxes wrap text?</font></p>
<p><strong><font color="#0000FF" size="2" face="Verdana">TextBox Methods</font></strong></p>
<p><font color="#000000" size="2" face="Verdana">The TextBox only has one method
associated with it. This method is the "OnTextChanged" method. When
this method is set to a certain subroutine, that subroutine will be called if
the text has been changed. Lets see an example.</font></p>
<table
width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" class="normal" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td width="100%" bgcolor="#C0C0C0"><div align="left">
<p><b><u>Code</u>: TextChanged.aspx<br>
<br>
<font color="#0000FF"><script runat="server"></font><br>
<font color="#006600">Sub Page_Load</font><br>
' I don't want anything to be called when the page is loaded. <br>
<font color="#006600">End Sub</font><br>
<br>
<font color="#006600">Sub Text1_Changed(sender As Object, e As System.EventArgs)</font><br>
Response.Write ("You changed the text!")<br>
<font color="#006600">End Sub</font><br>
<br>
<font color="#0000FF"></script></font> <br>
<br>
<html><br>
<form runat="<font color="#FF0000">server</font>"></b><b><br>
<asp:TextBox id="<font color="#FF0000">mybox</font>" AutoPostBack="<font color="#FF0000">True</font>"
TextMode="<font color="#FF0000">SingleLine</font>" Columns="<font color="#FF0000">25</font>"
OnTextChanged="<font color="#FF0000">Text1_Changed</font>"
runat="<font
color="#FF0000">server</font>" /><br>
</form><br>
</html></b></p>
</div></td>
</tr>
</table>
<p><font size="2" face="Verdana">In the above example, we created a very basic
form with one textbox. For the textbox, we set autopostback to true. Because
of this, the textbox will be posted after modifications have been made. When
it is posted back, the subroutine, "Text1_Changed" will be called.
(This is set in the <strong>OnTextChanged="Text1_Changed"</strong>
method) Please take notice to the <strong>Sub Text1_Changed</strong> subroutine.
It has "(sender As Object, e As System.EventArgs)" attached to it.
You must have this attached to any subroutine handling form data. If you don't,
you will receive an error. In future articles, I will go into more detail about
form handling. </font></p>
<p><strong><font color="#0000FF" size="2" face="Verdana">Setting the Text Value
in Subroutine and outside of a Subroutine</font></strong></p>
<p><font color="#000000" size="2" face="Verdana"><strong>Setting the Text</strong>
value of a textbox while inside a subroutine is very easy. All you do is use
the <strong>Text</strong> property. Lets see an example first.</font></p>
<table
width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" class="normal" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td width="100%" valign="top" bgcolor="#C0C0C0">
<div align="left">
<p><b><u>Code</u>: TextSet.aspx<br>
<br>
<font color="#0000FF"><script runat="server"></font><br>
<font color="#006600">Sub Page_Load</font><br>
<font color="#003300">' When the page is loaded, set the text value
of the control named "mytextbox" equal to "My name is
Shane."</font><br>
<font color="#FF0000">mytextbox.Text = "My name is Shane."</font></b><b><br>
<font color="#006600">End Sub</font><br>
<br>
<font color="#0000FF"></script></font> <br>
<br>
<html><br>
<form runat="<font color="#FF0000">server</font>"></b><b><br>
<asp:TextBox id="<font color="#FF0000">mytextbox</font>"
TextMode="<font color="#FF0000">SingleLine</font>" Columns="<font color="#FF0000">25</font>"
runat="<font
color="#FF0000">server</font>" /><br>
</form><br>
</html></b></p>
</div></td>
</tr>
</table>
<p><font size="2" face="Verdana">In the example above, we used the Page_Load subroutine
to set some text into our textbox control entitled "mytextbox." It
is very easy! </font></p>
<p><font size="2" face="Verdana">Ok. What if you didn't want to set the text value
in a subroutine? Or, What if you wanted to set a default text value? You would
do something like this:</font></p>
<table
width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" class="normal" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td width="100%" valign="top" bgcolor="#C0C0C0"> <div align="left">
<p><b><u>Code</u>: TextDefault.aspx<br>
<br>
<font color="#0000FF"><script runat="server"></font><br>
<font color="#006600">Sub Page_Load</font><br>
<font color="#003300">' Nothing up here</font></b><b><br>
<font color="#006600">End Sub</font><br>
<br>
<font color="#0000FF"></script></font> <br>
<br>
<html><br>
<form runat="<font color="#FF0000">server</font>"><br>
<asp:TextBox id="<font color="#FF0000">mytextbox</font>"
TextMode="<font color="#FF0000">SingleLine</font>" Columns="<font color="#FF0000">25</font>"
<font color="#0000FF">Text="Default Text here!!"</font> runat="<font
color="#FF0000">server</font>" /><br>
</form><br>
</html></b></p>
</div></td>
</tr>
</table>
<p><font size="2" face="Verdana">All we did in the above example was add the <strong>Text
</strong>attribute to the textbox control. That's it! </font></p>
<table
width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" class="normal" id="AutoNumber1" style="border-collapse: collapse">
<tr>
<td width="100%" valign="top" bgcolor="#C0C0C0">
<div align="left">
<p><b><u>Important Notes:</u><br>
<br>
<font color="#0000FF">- Always surround your textbox with the "<form
runat="server">" tag and the closing "</form>"
tag. If you don't, you will receive an error.</font></b></p>
<p><b><font color="#0000FF">- There is no such thing as a multi-lined
password box or a single-lined textbox with multiple rows.</font></b></p>
</div></td>
</tr>
</table>
<p><font size="2" face="Verdana">In conclusion, you learned how to successfully
add a textbox control to your ASP.NET page, add different properties to change
to type, and set the text value. Not bad! In a future lesson, I will go into
more depth about form processing. </font></p>
<p><font size="2" face="Verdana">Try this: Create an ASP.NET page where it displays
a multi-lined textbox with a width of 25 and has 30 rows, but cannot be modified!
If you want me to see what you got, <a href="http://www.sourcecode-central.com/contact/">Contact</a>
me! </font></p>
<p><font size="2" face="Verdana">Until then, have a good one!</font></p>
Comentários originais (3)
Recuperado do Wayback Machine