<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>textbox &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/textbox/</link>
	<description>Feed of posts on WordPress.com tagged "textbox"</description>
	<pubDate>Mon, 28 Dec 2009 01:50:14 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[WPF: Change TextBox Selection Highlight Color]]></title>
<link>http://nickdarnell.wordpress.com/2009/12/17/wpf-change-textbox-selection-color-net-3-5/</link>
<pubDate>Thu, 17 Dec 2009 23:43:17 +0000</pubDate>
<dc:creator>Nick Darnell</dc:creator>
<guid>http://nickdarnell.wordpress.com/2009/12/17/wpf-change-textbox-selection-color-net-3-5/</guid>
<description><![CDATA[So if you&#8217;ve ever tried to change the selection color of the TextBox in WPF, you&#8217;ve prob]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>So if you&#8217;ve ever tried to change the selection color of the TextBox in WPF, you&#8217;ve probably found out really quickly that it&#8217;s not really doable in .Net 3.5.&#160; You&#8217;ve probably stumbled across this <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/bbffa6e3-2745-4e72-80d0-9cdedeb69f7f/" target="_blank">[thread]</a>, confirming that to be the case.&#160; In .Net 4.0 they&#8217;re going to be adding the capability to modify the selection color on a per text field basis which will be really cool, <a href="http://blogs.msdn.com/llobo/archive/2009/10/27/new-wpf-features-caretbrush-selectionbrush.aspx" target="_blank">[here]</a>.</p>
<p>But what if you&#8217;re stuck in .Net 3.5, isn&#8217;t there <em>something</em> you can do to fix this problem?&#160; Yes, but it&#8217;s a hack.</p>
<div style="font-family:courier new;background:white;color:black;font-size:8pt;overflow:auto;">
<p style="margin:0;"><span style="color:#2b91af;">SolidColorBrush</span> current = <span style="color:#2b91af;">SystemColors</span>.HighlightBrush;</p>
<p style="margin:0;"><span style="color:#2b91af;">FieldInfo</span> colorCacheField = <span style="color:blue;">typeof</span>(<span style="color:#2b91af;">SystemColors</span>).GetField(<span style="color:#a31515;">&#34;_colorCache&#34;</span>, <span style="color:#2b91af;">BindingFlags</span>.Static &#124; <span style="color:#2b91af;">BindingFlags</span>.NonPublic);</p>
<p style="margin:0;"><span style="color:#2b91af;">Color</span>[] _colorCache = (<span style="color:#2b91af;">Color</span>[])colorCacheField.GetValue(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">SystemColors</span>));</p>
<p style="margin:0;">_colorCache[14] = <span style="color:#2b91af;">Color</span>.FromArgb(0xFF, 0xFF, 0&#215;00, 0&#215;00);</p>
<p style="margin:0;">&#160;</p>
</p></div>
<p><a href="http://nickdarnell.files.wordpress.com/2009/12/image.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://nickdarnell.files.wordpress.com/2009/12/image_thumb.png?w=225&#038;h=87" width="225" height="87" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Calculator Demo -- Part 4]]></title>
<link>http://understandingcsharp.wordpress.com/2009/12/14/calculator-demo-part-4/</link>
<pubDate>Mon, 14 Dec 2009 11:01:25 +0000</pubDate>
<dc:creator>jmancine</dc:creator>
<guid>http://understandingcsharp.wordpress.com/2009/12/14/calculator-demo-part-4/</guid>
<description><![CDATA[After getting the window working, I wanted some interaction. I looked at &#8220;ProcessKey()&#8221; ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>After <a href="http://understandingcsharp.wordpress.com/2009/12/12/calculator-demo-part-3/">getting the window working</a>, I wanted some interaction. I looked at &#8220;ProcessKey()&#8221; to get started. I simply uncommented it in the &#8220;OnWindowKeyDown&#8221; method and then followed the code until there were no build errors.</p>
<p>It&#8217;s a very simple method as OOP recommends (I put in my own comments):</p>
<blockquote><p><code>private void ProcessKey(char c)<br />
        {<br />
            &#160;&#160;if (EraseDisplay) //EraseDisplay is a property<br />
            &#160;&#160;{<br />
                &#160;&#160;&#160;&#160;Display = string.Empty; //Display is a property<br />
                &#160;&#160;&#160;&#160;EraseDisplay = false;<br />
            &#160;&#160;}<br />
            &#160;&#160;AddToDisplay(c);<br />
        }</code></p></blockquote>
<p>This method first checks if we want to erase the display. (As commented, EraseDisplay and Display are properties of this class which I will look at next.) It then clears the Display property if need be and then calls a method to add the newly pressed character to the display.</p>
<p>Properties are a really cool feature of C#. <a href="http://www.csharp-station.com/tutorials/Lesson10.aspx">This tutorial</a> by <a href="http://www.csharp-station.com/default.aspx">C# Station</a> is a great introduction to how they can be used. Basically, they take away all the hassle of using getter/setter methods while still allowing you to customize how getting/setting is performed. The EraseDisplay and Display properties are as simple as you can get &#8212; and they could easily be removed to use the naked variables &#8220;_erasediplay&#8221; [sic] and &#8220;_display&#8221; &#8212; but, by structuring the code so that those variables be handled through properties allows for expansion such as validation or calling subroutines, etc.</p>
<p>Lastly, &#8220;AddToDisplay&#8221; is called. I think the programmer for this one wanted to make an example of nesting conditionals because it seems unnecessary (and I would have done it differently). Anyway, it starts by checking if a decimal point is already displayed. I&#8217;ve seen something like &#8220;IndexOf&#8221; in Python. It simply returns the index of the position in the string of the character you&#8217;re looking for. String indexes start at 0 so if it returns a number greater than or equal to 0 then it does appear in the string and the method returns without changing the display (what number system uses more than one decimal point?) otherwise, it inserts the decimal point at the end. If the user presses a number the next conditional gets invoked which simply inserts the number at the end. If the user presses backspace, the final conditional is invoked which removes a single character from the end or sets the display to empty if there are no more characters to remove. Finally, and in any situation except the forced return, there is a call to &#8220;UpdateDisplay&#8221;.</p>
<p>I&#8217;m definitely getting a better understanding of OOP principles. Each method above is focused on a single task and, if it needs to do something tangential to its core function, it calls upon another method to do that job. &#8220;ProcessKey&#8221; only exists to get the display ready before sending the character onto &#8220;AddToDisplay&#8221; which which does the work of altering the state of the display before calling &#8220;UpdateDisplay&#8221; which actually renders the new state.</p>
<p>The &#8220;UpdateDisplay&#8221; method warrants a closer look because it is so simple yet does so much (and there&#8217;s a lot of interesting stuff to talk about):</p>
<blockquote><p><code>        private void UpdateDisplay()<br />
        {<br />
            &#160;&#160;if (Display == String.Empty) //String.Empty vs Display.Length == 0<br />
                &#160;&#160;&#160;&#160;DisplayBox.Text = "0"; //DisplayBox is of type MyTextBox initialized in the constructor<br />
            &#160;&#160;else<br />
                &#160;&#160;&#160;&#160;DisplayBox.Text = Display;<br />
        }</code></p></blockquote>
<p>I say this method is simple because all it does is check if the display is empty and sets the text of &#8220;DisplayBox&#8221; (what the user sees) to 0 or to whatever value is in Display. I say it does so much because it makes use of a conditional, an interesting compare, and introduces a GUI element that it must alter.</p>
<p>Back when I was working on the <a href="http://understandingcsharp.wordpress.com/2009/12/07/alarm-clock-sample-%e2%80%94-part-5/">Alarm Clock Sample</a>, I came across <a href="http://www.tbiro.com/Check-empty-string-performance.htm">a website</a> that compared String.Empty with Foo.Length tests. I found <a href="http://dotnetperls.com/string-empty">another article</a> which explains why the length test would work so much faster. I would like someone to explain why it is ever useful because I intend to never use it in my own code from now on.</p>
<p>Now for the GUI. I first noticed &#8220;DisplayBox&#8221; is an instance of the class &#8220;MyTextBox&#8221; which is defined in the file <em>mytextbox.cs</em>. It inherits from &#8220;System.Windows.Controls.TextBox&#8221; and only overrides the &#8220;OnPreviewGotKeyboardFocus&#8221; event handler method and is being used exactly as <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.onpreviewgotkeyboardfocus.aspx">recommended</a>: mark it as handled and then invoke the <a href="http://msdn.microsoft.com/en-us/library/hfw7t1ce.aspx">base</a> class implementation to keep the train rolling. Second, I saw that the &#8220;DisplayBox&#8221; instance is added to the layout by use of the Grid. The grid is setup with XAML so I stuck it in my &#8220;InitializeThis&#8221; method:</p>
<blockquote><p><code>//&#60;DockPanel Name="MyPanel"&#62;<br />
            MyPanel = new DockPanel();</p>
<p>            //<br />
            MyGrid = new Grid();<br />
            MyGrid.Name = "MyGrid";<br />
            MyGrid.Background = Brushes.Wheat;<br />
            MyGrid.ShowGridLines = false;</p>
<p>            //<br />
            MyPanel.Children.Add(MyGrid);</p>
<p>            //<br />
            this.Content = MyPanel;</code></p></blockquote>
<p>I declared each instance variable outside the methods and marked them as &#8220;static&#8221; because they are logically contained within the entire and every &#8220;window1&#8243; object. The rest of the code is a direct translation from XAML based on what I came to understand previously so I won&#8217;t explain it further. However, I will explain my understanding of how &#8220;Grid&#8221; works. Again, I have to thank my Python experience for this. We tell the &#8220;DockPanel&#8221; that a Grid will manage the position and geometry of specified GUI objects (widgets). The Grid in .NET is much more sophisticated than TkInter in that you can specify many aspects of the Grid&#8217;s display rather than simply indicate how it will manage geometry, and, you must specify which objects will be managed by the Grid. The content of the window is then set as the &#8220;DockPanel&#8221; so it knows what to render for viewing.</p>
<p>I will implement the button animations next to flesh out the GUI, play around with animations again, and get ready for implementing operations.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Calculator Demo — Part 2]]></title>
<link>http://understandingcsharp.wordpress.com/2009/12/10/calculator-demo-%e2%80%94-part-2/</link>
<pubDate>Thu, 10 Dec 2009 05:32:02 +0000</pubDate>
<dc:creator>jmancine</dc:creator>
<guid>http://understandingcsharp.wordpress.com/2009/12/10/calculator-demo-%e2%80%94-part-2/</guid>
<description><![CDATA[By completing the Alarm Clock Sample, I got a pretty good understanding of how to program Windows Pr]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>By <a href="http://understandingcsharp.wordpress.com/2009/12/09/alarm-clock-sample-part-6/">completing</a> the Alarm Clock Sample, I got a pretty good understanding of how to program Windows Presentation Foundation using only C# and how XAML files are related to the .NET Class Library.</p>
<p>The calculator demo is a lot less intimidating now so I want to go back to it. Again, I will try to implement it using only C#. Translating the XAML into C# will still be difficult because of the heavily nested code seen in <em>window1.xaml</em> but it should be much easier now that I understand the syntax much more clearly. More interestingly, there is a lot of C# already used for the code-behind. In fact, there&#8217;s more C# than XAML so I&#8217;m hoping that what I learn from this project will be more relevant to the subject of this blog.</p>
<p>I&#8217;m assuming I don&#8217;t need to look at <em>resources.cs</em>, <em>resources.res</em>x, <em>settings.cs</em>, or <em>settings.settings</em> because they were useless in porting the Alarm Clock Sample. I fully understand what&#8217;s going on in <em>app.xaml</em> and <em>app.xaml.cs</em> thanks to <a href="http://understandingcsharp.wordpress.com/2009/11/29/alarm-clock-sample-part-1/">my earlier research</a>. A new &#8220;window1&#8243; object is instantiated on startup. It is defined by <em>window1.xaml</em> and <em>window1.xaml.cs</em>.</p>
<p>Immediately, I notice that <em>window1.xaml</em> is heavy on buttons and grid. Grid must be a kind of layout manager (in <a href="http://wiki.python.org/moin/TkInter">Tkinter</a> for <a href="http://www.python.org/">Python</a> there is also a grid geometry manager and they probably work similarly). It will be very worthwhile to come to an understanding about layout. There&#8217;s also a little bit about a menu (which is also useful to learn), simpler animation than the Alarm Clock Sample, and one instance of a TextBlock. My initial perusal has convinced me that a &#8220;TextBlock&#8221; is not the same as a &#8220;TextBox&#8221;.</p>
<p>There is a definition of class called MyTextBox in <em>mytextbox.cs</em> which inherits from the TextBox class and the only purpose seems to be to override a specific eventhandler: <code>OnPreviewGotKeyboardFocus</code>. I&#8217;ll figure the reason in the next installment but, for now, I&#8217;m satisfied with knowing it&#8217;s used in <em>window1.xaml.cs</em> along with the really interesting looking PaperTrail class.</p>
<p>As I mentioned before, <em>window1.xaml.cs</em> has a lot of program logic in it so I think it will be fun to go through to try to understand.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Calendar Extender and Textbox set to Read only in Asp.net - C#]]></title>
<link>http://pankajlalwani.wordpress.com/2009/11/30/calendar-extender-and-textbox-set-to-read-only-in-asp-net-c/</link>
<pubDate>Mon, 30 Nov 2009 10:29:52 +0000</pubDate>
<dc:creator>pankajlalwani</dc:creator>
<guid>http://pankajlalwani.wordpress.com/2009/11/30/calendar-extender-and-textbox-set-to-read-only-in-asp-net-c/</guid>
<description><![CDATA[Lets say we have a textbox control and calendar extender associated with it.Now if we want to set th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Lets say we have a textbox control and calendar extender associated with it.Now if we want to set the textbox to read only mode, we set Readonly = true</p>
<p>But there is a problem with it.</p>
<p><strong>Setting the readonly atrribute as stated here will not cause any serverside processing to occur. If you need the value in the textbox to be available serverside then use the attribute </strong></p>
<pre><strong>contentEditable="false" </strong></pre>
<p><strong> </strong></p>
<p><strong>rather than read only. This only works for IE browsers however. </strong></p>
<p>so the code becomes.</p>
<p>&#60;asp:TextBox ID=&#8221;txtDate&#8221; contentEditable=&#8221;false&#8221; runat=&#8221;server&#8221; CssClass=&#8221;txtcss&#8221;&#62;&#60;/asp:TextBox&#62;&#38;nbsp;<br />
&#60;asp:Image ID=&#8221;imgCal&#8221; runat=&#8221;server&#8221; ImageUrl=&#8221;~/img/calendar.gif&#8221; /&#62;<br />
&#60;cc1:CalendarExtender ID=&#8221;CalExtDate&#8221; runat=&#8221;server&#8221;  PopupButtonID=&#8221;imgCal&#8221;<br />
PopupPosition=&#8221;BottomLeft&#8221; Format=&#8221;dd/MM/yyyy&#8221;    TargetControlID=&#8221;txtDate&#8221;&#62;<br />
&#60;/cc1:CalendarExtender&#62;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Textbox für numerische Eingaben mit C# in Windows Forms]]></title>
<link>http://jokifux.wordpress.com/2009/11/22/138/</link>
<pubDate>Sun, 22 Nov 2009 13:11:08 +0000</pubDate>
<dc:creator>jokifux</dc:creator>
<guid>http://jokifux.wordpress.com/2009/11/22/138/</guid>
<description><![CDATA[Textbox für numerische Eingaben mit C# in Windows Forms Um eine Textbox auf numerische Eingaben zu b]]></description>
<content:encoded><![CDATA[Textbox für numerische Eingaben mit C# in Windows Forms Um eine Textbox auf numerische Eingaben zu b]]></content:encoded>
</item>
<item>
<title><![CDATA[How to Auto scroll TextBox, ListBox, ListView]]></title>
<link>http://elsaghir.wordpress.com/2009/11/18/how-to-auto-scroll-textbox-listbox-listview/</link>
<pubDate>Wed, 18 Nov 2009 17:58:01 +0000</pubDate>
<dc:creator>elsaghir</dc:creator>
<guid>http://elsaghir.wordpress.com/2009/11/18/how-to-auto-scroll-textbox-listbox-listview/</guid>
<description><![CDATA[Here are some info on how to do an Autoscroll for your program controls TextBox autoscroll textBox1.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><h2>Here are some info on how to do an Autoscroll for your program controls</h2>
<h2>TextBox autoscroll</h2>
<pre>textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();
</pre>
<h2>ListBox autoscroll</h2>
<pre>listBox1.SelectedIndex = listBox1.Items.Count - 1;
listBox1.SelectedIndex = -1;
</pre>
<h2>ListView autoscroll</h2>
<pre>listView1.EnsureVisible(listView1.Items.Count - 1);TreeView autoscroll</pre>
<pre>treeView1.Nodes[treeView1.Nodes.Count - 1].EnsureVisible();
</pre>
<h2>DataGridView autoscroll</h2>
<pre>dataGridView1.FirstDisplayedCell =
dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[multiline textbox in wpf]]></title>
<link>http://dotnettrails.wordpress.com/2009/11/16/multiline-textbox-in-wpf/</link>
<pubDate>Mon, 16 Nov 2009 08:49:19 +0000</pubDate>
<dc:creator>dotnettrails</dc:creator>
<guid>http://dotnettrails.wordpress.com/2009/11/16/multiline-textbox-in-wpf/</guid>
<description><![CDATA[As a windows forms application/web application developer you might be looking for MultiLine property]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>As a windows forms application/web application developer you might be looking for MultiLine property while developing in WPF. You will be surprised to see that there is no property like that.</p>
<p align="left">Trick is you have to set AcceptsReturn=&#34;True&#34; TextWrapping=&#34;Wrap&#34; and VerticalScrollBarVisibility=&#34;Auto&#34; to get yourself a multiline textbox</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5cd1dbd0-0a6d-498c-ac14-f3d3c0edbba1" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>,<a href="http://technorati.com/tags/Simple+things" rel="tag">Simple things</a>,<a href="http://technorati.com/tags/Multiline" rel="tag">Multiline</a>,<a href="http://technorati.com/tags/textbox" rel="tag">textbox</a>,<a href="http://technorati.com/tags/multiline+textbox" rel="tag">multiline textbox</a>,<a href="http://technorati.com/tags/acceptsreturn" rel="tag">acceptsreturn</a></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ejemplo de Drag &amp; Drop]]></title>
<link>http://jsbsan.wordpress.com/2009/11/01/ejemplo-de-drag-drop/</link>
<pubDate>Sun, 01 Nov 2009 18:56:36 +0000</pubDate>
<dc:creator>jsbsan</dc:creator>
<guid>http://jsbsan.wordpress.com/2009/11/01/ejemplo-de-drag-drop/</guid>
<description><![CDATA[Gracias al foro de http://www.gambas-es.org/ y a sus integrantes que me han ayudado a resolver mis d]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Gracias al foro de<a href="http://www.gambas-es.org/viewtopic.php?t=125&#38;p=796#p796"> http://www.gambas-es.org/</a> y a sus integrantes que me han ayudado a resolver mis dudas sobre drag y drop, he podido  realizar este pequeño programa para ejemplo de su aplicación.</p>
<p>Se trata de utilizar<strong> drag y drop</strong> entre textbox y listbox, (pasarse datos con coger y soltar), que resultara muy cómodo al usuario de nuestros programas a la hora de añadir datos, moverlos, etc..</p>
<p><a href="http://jsbsan.wordpress.com/files/2009/11/cogerysoltar.jpg"><img src="http://jsbsan.wordpress.com/files/2009/11/cogerysoltar.jpg" alt="cogerysoltar" title="cogerysoltar" width="383" height="322" class="alignnone size-full wp-image-937" /></a></p>
<p>Y este es el codigo del formulario principal:</p>
<p><code><br />
' Gambas class file<br />
'propiedades drog:<br />
'TextBox2.Drop debes declararlas  desde el editor de propiedades TRUE<br />
'ListBox1.Drop debes declararlas  desde el editor de propiedades TRUE<br />
'listbox2.Drop debes declararlas  desde el editor de propiedades TRUE<br />
PUBLIC SUB Form_Open()<br />
ListBox1.Add("Andalucia")<br />
ListBox1.Add("Canarias")<br />
listbox1.add("Murcia")<br />
END<br />
'coger<br />
PUBLIC SUB TextBox1_MouseDrag()<br />
  IF Mouse.Left THEN<br />
     TextBox1.Drag(TextBox1.Text)<br />
    ENDIF<br />
 END<br />
PUBLIC SUB ListBox1_MouseDrag()<br />
  IF Mouse.Left THEN<br />
   listbox1.Drag(ListBox1[ListBox1.index].text)<br />
  ENDIF<br />
END<br />
PUBLIC SUB ListBox2_MouseDrag()<br />
  IF Mouse.Left THEN<br />
   listbox2.Drag(ListBox2[ListBox2.index].text)<br />
  ENDIF<br />
END<br />
'soltar<br />
PUBLIC SUB TextBox2_Drop()<br />
  TextBox2.text = Drag.Data<br />
END<br />
PUBLIC SUB ListBox1_Drop()<br />
  ListBox1.Add(Drag.data)<br />
  END<br />
PUBLIC SUB listbox2_Drop()<br />
  ListBox2.Add(Drag.data)<br />
END<br />
</code></p>
<p>Aqui teneis el <a href="http://www.proyectojulio.webcindario.com/home/julio/cogerysoltar/Cogerysoltar-0.0.1.tar.gz">codigo fuente</a></p>
<p>Y de nuevo gracias al foro y a las personas que han hecho posible este programa.</p>
<p>Espero que os sea util, un saludo</p>
<p>Julio</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Three-State CheckBox]]></title>
<link>http://dutchmarcel.wordpress.com/2009/10/21/the-three-state-checkbox/</link>
<pubDate>Wed, 21 Oct 2009 18:37:02 +0000</pubDate>
<dc:creator>DutchMarcel</dc:creator>
<guid>http://dutchmarcel.wordpress.com/2009/10/21/the-three-state-checkbox/</guid>
<description><![CDATA[In my previous post I explained why you should use the ‘CustomControl (WPF)’ template from the Add N]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In my <a href="http://dutchmarcel.wordpress.com/2009/10/17/creating-a-custom-control/" target="_blank">previous post</a> I explained why you should use the ‘CustomControl (WPF)’ template from the Add New Item dialog when you want to create a custom control. But of course there’s an exception to this rule! When you only want to make (minor) changes to the functionality of a base control, you don’t always need the stuff that Visual Studio generates for you. That stuff is generated so you can create your own presentation (ControlTemplate) for your control. But what if you only want to change the logic?</p>
<p>Consider the following scenario:</p>
<p style="padding-left:30px;">Some people want to use the CheckBox’s ‘Indeterminate’ state as a representation for ‘the user hasn’t made a choice yet’. And if you’re like me, if I click on a checkbox I expect it to go into its Checked state. And if you combine these facts you might find it annoying that when you click on an Indeterminate checkbox, it turns Unchecked, instead of Checked.</p>
<p>Now, can we fix this without all the stuff that Visual Studio generates for you? After all, we don’t want to change the presentation of the checkbox or its states, just the sequence order of the states. The answer is: yes, of course we can!</p>
<p>In this case we don’t use the ‘CustomControl’ template, but we just add a new Class to our project. Taking this road, we don’t have the automatically generated static constructor with the DefaultStyleKey override in our class, but that’s fine, because in our scenario we explicitly <em>don’t</em> want an override to tell WPF to use a custom control template. We just want the standard control template to be used.</p>
<p>Now we only have to make our class inherit from the standard CheckBox and implement our modification:</p>
<pre class="brush: csharp;">
public class CustomThreeStateCheckBox : CheckBox
{
    public CustomThreeStateCheckBox()
    {
        // Always start in the 'Indeterminate' state
        base.IsChecked = null;
    }

    protected override void OnToggle()
    {
        // Change the sequence from: Unchecked - Checked - Indeterminate
        // to: Indeterminate - Checked - Unchecked
        if (this.IsChecked == false)
        {
            this.IsChecked = this.IsThreeState ? null : ((bool?)true);
        }
        else
        {
            this.IsChecked = new bool?(!this.IsChecked.HasValue);
        }
    }
}
</pre>
<p>Another example of a ‘semi-custom’ control could be a numeric TextBox. If you just want to ignore any character that cannot be parsed to a double, this simple class might be all you need:</p>
<pre class="brush: csharp;">
public class NumericTextBox : TextBox
{
    protected override void OnPreviewTextInput(System.Windows.Input.TextCompositionEventArgs e)
    {
        // Ignore any character that fails to parse to a double
        double value;
        if (!Double.TryParse(e.Text, out value))
            e.Handled = true;
        base.OnPreviewTextInput(e);
    }
}
</pre>
<p>The advantage of these kinds of custom controls is that it’s less work and they will respect the Windows theme your application is running in, without having to create several different theme-styles for them.</p>
<p>So, every time you’re about to create a custom control, take the time to check if you really need a new control template, because it’s time well spent!</p>
<p><a href="http://dutchmarcel.wordpress.com/files/2009/10/semicustomcontroltestzip.doc">Download source code.</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Input Numeric Only]]></title>
<link>http://rendramm2.wordpress.com/2009/10/16/input-numeric-only/</link>
<pubDate>Fri, 16 Oct 2009 04:51:18 +0000</pubDate>
<dc:creator>Rendra</dc:creator>
<guid>http://rendramm2.wordpress.com/2009/10/16/input-numeric-only/</guid>
<description><![CDATA[Untuk validasi ketika ngetik di suatu textbox jadi hanya numerik saja yang bisa diinputkan. Ni buat ]]></description>
<content:encoded><![CDATA[Untuk validasi ketika ngetik di suatu textbox jadi hanya numerik saja yang bisa diinputkan. Ni buat ]]></content:encoded>
</item>
<item>
<title><![CDATA[Textbox'a Keypress Olayı (event)]]></title>
<link>http://ca0011.wordpress.com/2009/10/12/textbox-keypress/</link>
<pubDate>Mon, 12 Oct 2009 13:58:09 +0000</pubDate>
<dc:creator>cuneyq</dc:creator>
<guid>http://ca0011.wordpress.com/2009/10/12/textbox-keypress/</guid>
<description><![CDATA[Textbox&#8217;ın Keypress olayı, klavyeden girilen tuşları yakalamanıza yardımcı olur. Yazılmasını i]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Textbox&#8217;ın <strong>Keypress </strong>olayı, klavyeden girilen tuşları yakalamanıza yardımcı olur. Yazılmasını istediğimiz/istemediğimiz tuşları bu olay sayesinde kontrol edebiliiz.</p>
<p>Örneğin ;</p>
<p>Aşağıdaki kodu yazdığınız takdirde, Textbox içerisine sadece sayısal değerler girebilirsiniz.</p>
<blockquote><p>e.Handled = ((e.KeyChar &#62;= &#8216;0&#8242; &#38;&#38; e.KeyChar &#60;= &#8216;9&#8242;)) ? false : true;</p></blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Text Insert in TextBox In Silverlight 3]]></title>
<link>http://diptimayapatra.wordpress.com/2009/10/12/text-insert-in-textbox-in-silverlight-3/</link>
<pubDate>Mon, 12 Oct 2009 04:32:54 +0000</pubDate>
<dc:creator>dpatra1982</dc:creator>
<guid>http://diptimayapatra.wordpress.com/2009/10/12/text-insert-in-textbox-in-silverlight-3/</guid>
<description><![CDATA[Introduction There are various requirements for the TextBox Text input. In this article we will see ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><h1>Introduction<br />
</h1>
<p>There are various requirements for the TextBox Text input. In this article we will see how can we insert text in any TextBox Caret position.
</p>
<h1>Creating Silverlight Project<br />
</h1>
<p>Fire up Visual Studio 2008 and create a new Silverlight 3 Project. Name it as TextInsert.
</p>
<p><img src="http://diptimayapatra.files.wordpress.com/2009/12/121709_0432_textinserti1.png">
	</p>
<p>
 </p>
<p>Here is the Idea, there will be a list of Text in a combo box and we need to add the selected Text from the ComboBox to the carat position of TextBox.
</p>
<p>Open the Solution and design the above.
</p>
<p><img src="http://diptimayapatra.files.wordpress.com/2009/12/121709_0432_textinserti2.png">
	</p>
<p>Now insert some text to the ComboBox in the application load.
</p>
<p><span style="font-size:10pt;"><span style="color:blue;">public</span> MainPage()<br />
</span></p>
<p><span style="font-size:10pt;">        {<br />
</span></p>
<p><span style="font-size:10pt;">            InitializeComponent();<br />
</span></p>
<p><span style="font-size:10pt;"><br />
			<span style="color:#2b91af;background-color:yellow;">List</span><span style="background-color:yellow;">&#60;<span style="color:blue;">string</span>&#62; myList = <span style="color:blue;">new</span><br />
				<span style="color:#2b91af;">List</span>&#60;<span style="color:blue;">string</span>&#62;()<br />
</span></span></p>
<p><span style="font-size:10pt;background-color:yellow;">            {<br />
</span></p>
<p><span style="font-size:10pt;background-color:yellow;"><br />
			<span style="color:#a31515;">&#8220;[UserName]&#8220;</span>,<span style="color:#a31515;">&#8220;[Sender]&#8220;</span>, <span style="color:#a31515;">&#8220;[UserContact]&#8220;</span>, <span style="color:#a31515;">&#8220;[UserAddress]&#8220;<br />
</span></span></p>
<p><span style="font-size:10pt;background-color:yellow;">            };<br />
</span></p>
<p><span style="font-size:10pt;"><span style="background-color:yellow;">            cmbTexts.ItemsSource = myList;</span><br />
		</span></p>
<p><span style="font-size:10pt;">        }<br />
</span></p>
<p>Now create an event handle of ComboBox SelectionChanged.
</p>
<p><span style="color:red;font-size:10pt;">SelectionChanged<span style="color:blue;">=&#8221;cmbTexts_SelectionChanged&#8221;<br />
</span></span></p>
<p>Add the following code into the above handler.
</p>
<p><span style="font-size:10pt;"><span style="color:blue;">private</span><br />
			<span style="color:blue;">void</span> cmbTexts_SelectionChanged(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">SelectionChangedEventArgs</span> e)<br />
</span></p>
<p><span style="font-size:10pt;">        {<br />
</span></p>
<p><span style="font-size:10pt;"><br />
			<span style="color:blue;">string</span> selected = txtMyTextBox.Text;<br />
</span></p>
<p><span style="font-size:10pt;"><br />
			<span style="color:blue;">int</span> positionNotificationTemplate = txtMyTextBox.SelectionStart;<br />
</span></p>
<p><span style="font-size:10pt;"><br />
			<span style="color:blue;">string</span> strTemp1 = cmbTexts.SelectedItem.ToString();<br />
</span></p>
<p><span style="font-size:10pt;">            selected = selected.Insert(positionNotificationTemplate, strTemp1);<br />
</span></p>
<p><span style="font-size:10pt;">            txtMyTextBox.Text = selected;<br />
</span></p>
<p><span style="font-size:10pt;">        }<br />
</span></p>
<p>Now run the application and write your message in TextBox.
</p>
<p><img src="http://diptimayapatra.files.wordpress.com/2009/12/121709_0432_textinserti3.png">
	</p>
<p>Hope this article is helpful.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[C# application that counts the number of characters being entered ]]></title>
<link>http://aaronharvey.wordpress.com/2009/09/27/c-application-that-counts-the-number-of-characters-being-entered/</link>
<pubDate>Sun, 27 Sep 2009 13:47:21 +0000</pubDate>
<dc:creator>aaronharveyuk</dc:creator>
<guid>http://aaronharvey.wordpress.com/2009/09/27/c-application-that-counts-the-number-of-characters-being-entered/</guid>
<description><![CDATA[This application consists of a textbox and a label. As the user types in the text box the label disp]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This application consists of a textbox and a label. As the user types in the text box the label displays the number of characters that have been entered. The code is as follows :</p>
<p>private void textBox1_TextChanged (object sender, EventArgs e)</p>
<p>{<br />
int charactercount;<br />
string labeloutput;</p>
<p>charactercount = textBox1.TextLength;<br />
labeloutput = charactercount.ToString();</p>
<p>lblcount.Text = &#8220;Character count : &#8221; + labeloutput;</p>
<p>{</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Collect user input from form and change it to upper or lower case in C# ]]></title>
<link>http://aaronharvey.wordpress.com/2009/09/27/collect-user-input-from-form-and-change-it-to-upper-or-lower-case-in-c/</link>
<pubDate>Sun, 27 Sep 2009 13:44:16 +0000</pubDate>
<dc:creator>aaronharveyuk</dc:creator>
<guid>http://aaronharvey.wordpress.com/2009/09/27/collect-user-input-from-form-and-change-it-to-upper-or-lower-case-in-c/</guid>
<description><![CDATA[In this example I have a text box on my windows form to collect the user input and a label to displa]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In this example I have a text box on my windows form to collect the user input and a label to display the outcome once a button is pressed. The code is as follows to change the input to upper and lower case.</p>
<p>private void button3_Click(object sender, EventArgs e)</p>
<p>{</p>
<p>label1.Text = textBox.Text.ToUpper();</p>
<p>}</p>
<p>or</p>
<p>{</p>
<p>label1.Text = textBox.Text.ToLower();</p>
<p>}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Personalizar un TextBox en WPF con Expresion Blend]]></title>
<link>http://escarbandocodigo.wordpress.com/2009/09/24/personalizar-un-textbox-en-wpf-con-expresion-blend/</link>
<pubDate>Thu, 24 Sep 2009 18:53:46 +0000</pubDate>
<dc:creator>Martin Reina</dc:creator>
<guid>http://escarbandocodigo.wordpress.com/2009/09/24/personalizar-un-textbox-en-wpf-con-expresion-blend/</guid>
<description><![CDATA[Para este ejemplo lo que necesitamos es: -          Microsoft Expresion Blend 3 -          Visual St]]></description>
<content:encoded><![CDATA[Para este ejemplo lo que necesitamos es: -          Microsoft Expresion Blend 3 -          Visual St]]></content:encoded>
</item>
<item>
<title><![CDATA[Watermark TextBox using JavaScript]]></title>
<link>http://jskharay.wordpress.com/2009/09/21/watermark-textbox-using-javascript/</link>
<pubDate>Mon, 21 Sep 2009 06:02:17 +0000</pubDate>
<dc:creator>Jaspreet Singh</dc:creator>
<guid>http://jskharay.wordpress.com/2009/09/21/watermark-textbox-using-javascript/</guid>
<description><![CDATA[&lt;script type = “text/javascript”&gt; var defaultText = “Enter your text here”; function WaterMark]]></description>
<content:encoded><![CDATA[&lt;script type = “text/javascript”&gt; var defaultText = “Enter your text here”; function WaterMark]]></content:encoded>
</item>
<item>
<title><![CDATA[Display textbox when RadioButton is clicked (Using Javascript)]]></title>
<link>http://liyens.wordpress.com/2009/09/20/display-textbox-when-radiobutton-is-clicked-using-javascript/</link>
<pubDate>Sun, 20 Sep 2009 15:53:10 +0000</pubDate>
<dc:creator>liyenz</dc:creator>
<guid>http://liyens.wordpress.com/2009/09/20/display-textbox-when-radiobutton-is-clicked-using-javascript/</guid>
<description><![CDATA[This source code is using the javascript to display the textbox when a radiobutton is clicked. This ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><span style="color:#3366ff;">This source code is using the javascript to display the textbox when a radiobutton is clicked. This applies when a user clicks the other specify radio button and the javascript is called to display the textbox. Then, the textbox will be validated if empty.</span></p>
<p><span style="color:#3366ff;">//Javascript<br />
function InterfaceControl1(id)<br />
{<br />
var radioQ1 = document.getElementsByName(id);<br />
for (var ii = 0; ii &#60; (radioQ1ii++)<br />
{<br />
if (radioQ1[ii].checked){<br />
if (radioQ1[ii].value == &#8220;O&#8221;){<br />
document.getElementById(&#8220;txtQ1&#8243;).style.display = &#8216;inline&#8217;; //to show<br />
}<br />
else<br />
{<br />
document.getElementById(&#8220;txtQ1&#8243;).style.display = &#8216;none&#8217;; //to hide<br />
}<br />
}<br />
}<br />
}</span></p>
<p><span style="color:#3366ff;">The design code is as below:<br />
</span></p>
<p><span style="color:#3366ff;">&#60;asp:RadioButtonList ID=&#8221;rbtnQ1&#8243; runat=&#8221;server&#8221; RepeatColumns=&#8221;2&#8243; RepeatDirection=&#8221;Horizontal&#8221; CssClass=&#8221;chkBoxList&#8221; OnClick=&#8221;javascript:InterfaceControl1(&#8216;rbtnQ1&#8242;);&#8221;&#62;<br />
&#60;asp:ListItem Text=&#8221;SteelSeries&#8221; Value=&#8221;SteelSeries&#8221;&#62;&#60;/asp:ListItem&#62;<br />
&#60;asp:ListItem Text=&#8221;Razer&#8221; Value=&#8221;Razer&#8221;&#62;&#60;/asp:ListItem&#62;<br />
&#60;asp:ListItem Text=&#8221;Logitech&#8221; Value=&#8221;Logitech&#8221;&#62;&#60;/asp:ListItem&#62;<br />
&#60;asp:ListItem Text=&#8221;Microsoft&#8221; Value=&#8221;Microsoft&#8221;&#62;&#60;/asp:ListItem&#62;<br />
&#60;asp:ListItem Text=&#8221;Others (Please specify)&#8221; Value=&#8221;O&#8221;&#62;&#60;/asp:ListItem&#62;<br />
&#60;/asp:RadioButtonList&#62;<br />
&#60;asp:TextBox ID=&#8221;txtQ1&#8243; runat=&#8221;server&#8221; style=&#8221;display:none;&#8221; MaxLength=&#8221;50&#8243; ValidationGroup=&#8221;vdgSubmit&#8221;&#62;&#60;/asp:TextBox&#62;<br />
&#60;asp:RequiredFieldValidator ID=&#8221;rfvQ1&#8243; runat=&#8221;server&#8221; ControlToValidate=&#8221;txtQ1&#8243; ErrorMessage=&#8221;Please fill in&#8221; ForeColor=&#8221;Red&#8221; &#62;&#60;/asp:RequiredFieldValidator&#62;<br />
&#60;br /&#62;&#60;br /&#62;</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[find control inside gridview]]></title>
<link>http://backupcode.wordpress.com/2009/09/19/find-control-inside-gridview/</link>
<pubDate>Sat, 19 Sep 2009 08:01:28 +0000</pubDate>
<dc:creator>backupcode</dc:creator>
<guid>http://backupcode.wordpress.com/2009/09/19/find-control-inside-gridview/</guid>
<description><![CDATA[Insert the following code on SelectedIndexChanged event of the gridview controlL: Dim myRow As GridV]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Insert the following code on SelectedIndexChanged event of the gridview controlL:</p>
<p><code><br />
Dim myRow As GridViewRow = myGridView.SelectedRow<br />
           Dim myTextBox1 As TextBox = CType(myRow.FindControl("myTextBox1"), TextBox)<br />
            Dim myTextBox2 As TextBox = CType(myRow.FindControl("myTextBox2"), TextBox)<br />
            If myTextBox1.Text = "" And myTextBox2.Text = "" Then<br />
                Exit Sub<br />
            Else<br />
  End If<br />
</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[enable disable a textbox]]></title>
<link>http://backupcode.wordpress.com/2009/09/18/enable-disable-a-textbox/</link>
<pubDate>Fri, 18 Sep 2009 11:46:26 +0000</pubDate>
<dc:creator>backupcode</dc:creator>
<guid>http://backupcode.wordpress.com/2009/09/18/enable-disable-a-textbox/</guid>
<description><![CDATA[The following function will enable a textbox control: Public Sub enabledtextbox(ByVal myCollection A]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The following function will enable a textbox control:</p>
<p><code><br />
Public Sub enabledtextbox(ByVal myCollection As ControlCollection)<br />
        Dim myControl As Control<br />
        For Each myControl In myCollection<br />
            If TypeOf myControl Is TextBox Then<br />
                CType(myControl, TextBox).ReadOnly = False<br />
            End If<br />
            enabledtextbox(myControl.Controls)<br />
        Next<br />
    End Sub<br />
</code></p>
<p>This function will disable the textbox:</p>
<p><code><br />
Public Sub disabledtextbox(ByVal myCollection As ControlCollection)<br />
       Dim myControl As Control<br />
        For Each myControl In myCollection<br />
            If TypeOf myControl Is TextBox Then<br />
                CType(myControl, TextBox).ReadOnly = True<br />
            End If<br />
            disabledtextbox(myControl.Controls)<br />
        Next<br />
    End Sub<br />
</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Readonly textbox value lost on postback]]></title>
<link>http://littletalk.wordpress.com/2009/09/07/readonly-textbox-value-lost-on-postback/</link>
<pubDate>Mon, 07 Sep 2009 12:39:00 +0000</pubDate>
<dc:creator>ken zheng</dc:creator>
<guid>http://littletalk.wordpress.com/2009/09/07/readonly-textbox-value-lost-on-postback/</guid>
<description><![CDATA[I am sure I have came across this before. In Asp .net 2.0, a readonly textbox value will not be pass]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I am sure I have came across this before. In Asp .net 2.0, a readonly textbox value will not be passed if it is set by Javascript. To get the value you will  just manually read the value from the request headers (this.TextBox1.Text = Request[this.TextBox1.UniqueID];), which poses a security risk and introduces the problem that 2.0 addresses.</p>
<p>With 2.0, the TextBox control&#8217;s ReadOnly property&#8217;s behavior has changed slightly. From the technical docs:</p>
<p>    The Text value of a TextBox control with the ReadOnly property set to true is sent to the server when a postback occurs, but the server does no processing for a read-only text box. This prevents a malicious user from changing a Text value that is read-only. The value of the Text property is preserved in the view state between postbacks unless modified by server-side code.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Programando para Windows no Visual C++]]></title>
<link>http://codewars.wordpress.com/2009/09/04/programando-para-windows-no-visual-c/</link>
<pubDate>Fri, 04 Sep 2009 22:41:11 +0000</pubDate>
<dc:creator>negativepositivenegative</dc:creator>
<guid>http://codewars.wordpress.com/2009/09/04/programando-para-windows-no-visual-c/</guid>
<description><![CDATA[Iniciantes que usavam Dev C++ ou outro compilador sem muitos recursos não sabem nem por onde começar]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Iniciantes que usavam Dev C++ ou outro compilador sem muitos recursos não sabem nem por onde começar no Visual C++. Neste tutorial vou sanar essas dúvidas e ensinar a criar projetos de console básicos e uma janela simples do Windows. Assumo que vocês já tenham um conhecimento básico de C++. Se não tem o Visual C++ 2008 instalado pode baixá-lo <a href="http://tr.im/xUxR">aqui</a>. Primeiro vamos conhecer a interface do Visual C++ e estudar os botões que nos interessam.</p>
<p>1 &#8211; New Project: Botão para criar um novo projeto.</p>
<p>2 &#8211; Solution Explorer: Navegador de projetos. É por ele que você navega pelos arquivos do seu projeto.</p>
<p>3 &#8211; Add new Item: Simples, botão para adicionar novo arquivo para um projeto já existente.</p>
<p>4 &#8211; Toolbox: Menu com componentes para janelas.</p>
<p>5 &#8211; Output: Os resultados da compilação e debug do projeto aparece aqui.</p>
<p><img class="aligncenter size-full wp-image-164" title="visual_interface" src="http://codewars.wordpress.com/files/2009/09/visual_interface.png" alt="visual_interface" width="600" height="338" /></p>
<p>Seguindo em frente, crie um novo projeto clicando no botão 1. Um diálogo se iniciará, em project types vá em Visual C++ e em templates escolha Win32 Console Application, digite um nome e pressione ok. Na próxima janela clique em next e na próxima marque a checkbox Empty Project em Additional Options e clique em Finish. Um novo projeto se iniciará no Solution Explorer. Mas o projeto não tem nenhum arquivo! Então temos de criar um novo item clicando no botão 2. Outro diálogo se iniciará, selecione C++ File e digite um nome. Agora podemos ver que a página inicial foi substituída por um espaço branco, que é onde deverá ser colocado o código do arquivo que você acabou de criar. Veja que o arquivo que criou aparece no solution explorer na pasta Source Files, como na imagem abaixo. Digite o código como na imagem.</p>
<p><img class="aligncenter size-full wp-image-165" title="code" src="http://codewars.wordpress.com/files/2009/09/code.png" alt="code" width="582" height="290" /></p>
<p>Aperte f5 para compilar e rodar o programa e está tudo pronto! Você deve ver um prompt onde está escrito: Hello World! Press any key to continue&#8230;. Você pode ver o log de debug e compilação no output, podendo determinar qual aparecerá no combo Box Show output From:</p>
<p><strong>CRIANDO JANELAS NO VISUAL C++</strong></p>
<p>Criar janelas no Visual C++ causa dúvidas em muitos iniciantes, e não só no Visual C++, criar janelas em C++ causa muitas dúvidas independente do compilador, eu mesmo já passei por essas dúvidas quando estava começando. O Visual C++ tem vários facilitadores, e até tem uma extensão para C++, o C++/CLI ou C++/CLR. Para criar um novo projeto de janelas, inicie um novo projeto e vá em Windows Forms Application. Digite um nome, clique em Finish, Next e Next. Um novo projeto se iniciará, e magicamente surgirá um modelo de janela no lugar da página inicial. Agora entra o Toolbox. Posicione o cursor sobre o toolbox, e deverá aparecer um menu com diferentes componentes, como na imagem abaixo:</p>
<p><img class="aligncenter size-full wp-image-166" title="toolbox" src="http://codewars.wordpress.com/files/2009/09/toolbox.png" alt="toolbox" width="600" height="322" /></p>
<p>Poderíamos apertar f5 agora e uma janela apareceria, e pronto, já sabe como criar uma janela. Mas a fonte de dúvidas dos iniciantes é como relacionar o código a janela e seus componentes. Como exemplo, arraste da toolbox um botão, um textBox e uma label para a janela. As propriedades desses componentes(como texto, etc..)  podem ser editadas no menu Properties, que pode ser aberto ao clicar com o botão direito no componente e depois em Properties. Dê um double-click no botão para ir ao seu listener. Listener? Para quem não sabe, um listener de botão geralmente faz o código dentro dele executar quando o botão é clicado. Copie o código abaixo para dentro do listener do botão:</p>
<blockquote><p>int TextBoxValue = System::Int32::Parse(textBox1-&#62;Text);<br />
label1-&#62;Text = TextBoxValue.ToString();</p></blockquote>
<p>Esse código armazenará o texto do textBox1 numa variável chamada TextBoxValue do tipo inteiro e o colocará como texto da label1. A função System::Int32::Parse(String) é o conversor CLR de String do sistema para int. Agora aperte f5 e teste o programa!</p>
<p><img class="aligncenter size-full wp-image-167" title="finished" src="http://codewars.wordpress.com/files/2009/09/finished.png" alt="finished" width="430" height="308" /></p>
<p>Temos uma janela funcional! Para ter certeza de que entendeu faça a label exibir uma mensagem de erro quando o valor da textbox for maior que 20.</p>
<p><strong>CONCLUSÕES</strong></p>
<p>Criar janelas no Visual C++ é muito fácil, apesar do CLR ter tirado um pouco da flexibilidade da linguagem na minha opinião. Se você quiser criar janelas com puro código C++ dê uma olhada <a href="http://forum.zwame.pt/showthread.php?t=75878">nesse tutorial</a>. Se tiver dúvidas sobre o Visual C++ pode visitar o <a href="http://msdn.microsoft.com/en-us/default.aspx">msdn</a>, um grande de centro de informações sobre produtos de programação da Microsoft.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[TextWraping in Silverlight]]></title>
<link>http://brandontruong.wordpress.com/2009/08/29/textwraping-in-silverlight/</link>
<pubDate>Sat, 29 Aug 2009 00:00:41 +0000</pubDate>
<dc:creator>brandontruong</dc:creator>
<guid>http://brandontruong.wordpress.com/2009/08/29/textwraping-in-silverlight/</guid>
<description><![CDATA[Just a little thing I came across when I am trying to set TextWraping property for a TextBox, but th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Just a little thing I came across when I am trying to set <span style="color:#ff0000;">TextWraping</span> property for a <span style="color:#000099;">TextBox</span>, but the text doesn&#8217;t seem to be wrapped. Then I realized if the <span style="color:#000099;">TextBox </span>is setting with <span style="color:#ff0000;">TextWraping </span>greater than 1, the text won&#8217;t be wrapped. Just a little thing to keep in mind <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=c6b044ac-b44a-81dd-bf65-f1018e71ee77" alt="" /></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Creating a textbox to scroll down automatically line by line]]></title>
<link>http://eactat.wordpress.com/2009/08/28/creating-a-textbox-to-scroll-down-automatically-line-by-line/</link>
<pubDate>Fri, 28 Aug 2009 12:47:21 +0000</pubDate>
<dc:creator>Hadi</dc:creator>
<guid>http://eactat.wordpress.com/2009/08/28/creating-a-textbox-to-scroll-down-automatically-line-by-line/</guid>
<description><![CDATA[If you use the textbox in VS you may find it very annoying, because if you add some text during time]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>If you use the textbox in VS you may find it very annoying, because if you add some text during time that your program is runed, the scrol will appear on left or right hand side of the box, but the user should move it manually to see the last text added to the textbox!!! :-@ same as bottom picture<!--more--></strong></p>
<p><a href="http://eactat.files.wordpress.com/2009/09/image28.png"><img class="alignleft" style="border:0 none;display:inline;margin-left:0;margin-right:0;" title="image" src="http://eactat.files.wordpress.com/2009/09/image_thumb28.png?w=244&#038;h=244" border="0" alt="image" width="244" height="244" align="left" /></a><strong> </strong></p>
<p><strong>These text are in Persian, sorry for inconvenient , but it does not matter.</strong></p>
<p><strong>This screen shot belongs to a program that I have written for an electronics devices that I and my dear friend, whose name is Masoud,  designed and we are still working at it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </strong></p>
<p><strong><br />
</strong></p>
<p><strong><br />
</strong></p>
<p><strong><br />
</strong></p>
<p><strong><br />
</strong></p>
<p><strong><br />
</strong></p>
<p><strong>All you need to do is that add these code to your program.</strong></p>
<p><strong>Actually, you should define new event for the textbox text changing , and add this codes</strong></p>
<p><span style="color:#004080;"> int len = 0;<br />
textBox1.Select(len, textBox1.Text.Length &#8211; len);<br />
len = textBox1.Text.Length;<br />
textBox1.ScrollToCaret();</span></p>
<p><strong>Do not forget to change the name of your textbox <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </strong></p>
<p><strong>Final code should looks like it :</strong></p>
<p><span style="color:#004080;">private void textBox1_TextChanged(object sender, EventArgs e)<br />
{<br />
int len = 0;<br />
textBox1.Select(len, textBox1.Text.Length &#8211; len);<br />
len = textBox1.Text.Length;<br />
textBox1.ScrollToCaret();<br />
}</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Formatando TextBox com valores decimais em jQuery]]></title>
<link>http://vertexna.wordpress.com/2009/08/21/formatando-textbox-com-valores-decimais-em-jquery/</link>
<pubDate>Sat, 22 Aug 2009 01:22:32 +0000</pubDate>
<dc:creator>Vitor Ussui</dc:creator>
<guid>http://vertexna.wordpress.com/2009/08/21/formatando-textbox-com-valores-decimais-em-jquery/</guid>
<description><![CDATA[Hoje eu precisei aplicar uma máscara de números decimais em um TextBox. Bem, é óbvio que fui atrás d]]></description>
<content:encoded><![CDATA[Hoje eu precisei aplicar uma máscara de números decimais em um TextBox. Bem, é óbvio que fui atrás d]]></content:encoded>
</item>

</channel>
</rss>
