|
If you have ever wanted a Label or TextBox in Windows Forms that performs a little more like on the web, then you've probably figured out that there's no intuitive way to make a Label or TextBox automatically adjust its height to fit the text it contains. While it may not be intuitive, it's definitely not impossible. In this example, I'll use a TextBox (you could just as easily use a Label) that is docked to the top of a form.To use this, add aTextBox called MyTextBox to the form, and set Dock to DockStyle.Top. Wire up the Resize event of the TextBox to this event handler. |
|
Last Updated ( Tuesday, 14 July 2009 16:49 )
|
|
Read more...
|
|
|
In this series, I’ll take a stab at explaining the different types of objects used in every day applications, how they are held in memory, and how they are eventually cleaned up. Along the way, I’ll hopefully clear up some of the haze that generally surrounds the stack, the heap, object finalization, memory leaks, “unmanaged resources,” the GC (garbage collector), and some other things. This is Part 1 of 4, covering managed and unmanaged code, and the stack. Part 2 will discuss the heap. Part 3 will cover boxing and unboxing, stucts and classes, nondeterministic finalization, IDisposable, and garbage collection. Part 4 will discuss buffer overruns, stack overflows, how to hack and Xbox, and a few best practices for memory-management-aware programming in .Net. |
|
Last Updated ( Sunday, 03 August 2008 22:27 )
|
|
Read more...
|
|
Type safety basically means using strongly-typed data to protect against nasty bugs caused by type errors. A “strong type” is a programming construct that imposes certain rules or restrictions on specific data and how the data can be used. A “type error” is a bug that only appears at runtime (as opposed to compile time), and can have a considerably undesirable impact on data – often it only appears when you discover that something has gone terribly wrong. So, we should always strive to write type-safe code. Here is an example. The following method call would not be considered type safe: |
|
Last Updated ( Saturday, 26 July 2008 20:16 )
|
|
Read more...
|
|
|
For a web project in Visual Studio 2005, there is by default no project file. The folder structure alone is used to define what’s in the project. To compare: In non-web projects, Visual Studio project files manage the locations of referenced assemblies. When a non-web project is built, Visual Studio looks into the project file and looks through its list of referenced assemblies. For each one, it compares the version in the local obj directory with the one located at the hint path in the project file. If it’s different, then the project can copy down the new version before it continues to build. This is how the projects can manage when “project references” and other references change. |
|
Last Updated ( Saturday, 26 July 2008 20:24 )
|
|
Read more...
|
|
Here's a C# pizzler for you -- see if you can figure it out. Do you think the assert will pass or fail? Is the wrong method getting called here? |
|
Last Updated ( Saturday, 26 July 2008 20:25 )
|
|
Read more...
|
|
|
|
|
<< Start < Prev 1 2 Next > End >>
|
|
Page 1 of 2 |