Deborah's Developer MindScape

         Tips and Techniques for Web and .NET developers.

Archive for February, 2010

February 27, 2010

Binding to a ComboBox using a DataTable and Linq

If you retrieve data into a DataTable, it is easy to bind it to a ComboBox. And before Linq, you would filter the DataTable using a DataView. But with Linq, you have some easy to use features for filtering the contents of your ComboBox. First, here is the basic code for binding a ComboBox to […]

Build a DataTable in Code

Filed under: C#,Data,VB.NET @ 6:49 pm

There may be times you need to build a DataTable using code instead of retrieving the data from a database. This post provides the code for building a DataTable using VB or C# code. In C#: DataTable dt = new DataTable("Customers"); DataColumn dc; dc = new DataColumn(); dc.DataType = typeof(int); dc.ColumnName = "CustomerID"; dt.Columns.Add(dc); dt.Columns.Add(new […]

EF and MEF at our User Group

Filed under: General,User Group @ 1:57 pm

We have the top experts on Entity Framework (EF) and the Managed Extensibility Framework (MEF) coming to the San Francisco EastBay.NET User Group on March 3, 2010! Both Julie Lerman and Kathleen Dollard will be here. During the FUNdamentals portion of the meeting, Julie introduces EF in Visual Studio 2010: Introduction to EF designer in […]

February 22, 2010

Building a Set of Alphabetic Letters

Filed under: C#,VB.NET @ 3:38 pm

There may be times you need to work with a set of alphabetic letters. Say you need to use "ABCDEFGHIJ" in your application. Now you could hard-code these in your application, but this post shows another technique for generating sets of letters. In C#: // Initialize an array with letters // This one does A, […]

Working with Char in a RichTextBox

Filed under: C#,VB.NET @ 3:26 pm

If you work with the RichTextBox control, you may find the need to work with individual characters within the control’s text string. The following demonstrates how to bold every uppercase character in a RichTextBox. In C#: richTextBox1.Text = "The ToCharArray function is very useful."; char ch; for (int i = 0; i <= richTextBox1.Text.Length – […]

Converting from String to Char or Visa Versa

Filed under: C#,VB.NET @ 3:18 pm

When working with Char values, you may need to convert an existing string to an array of chars, or you may want to convert an array of chars back into a single string. Converting a String to an Array of Char The following code converts a string to an array of Char. In C#: string […]

Setting a Char Value to a Symbol

Filed under: C#,VB.NET @ 3:15 pm

This prior post demonstrated how to set char values in VB and C#. But what if you want to display a special character, like a degree symbol? The following code displays a heart and a degree symbol. In C#: // Heart TextBox1.Font = new Font("Arial Unicode MS", 12, FontStyle.Regular); TextBox1.Text = ‘\u2764′.ToString(); // Degree symbol […]

Setting a Char Value

Filed under: C#,VB.NET @ 3:12 pm

Strings are a .NET data type that we use every day. But char, not so much. char is a built-in .Net data type used to declare a Unicode character. Unicode characters are 16-bit and can represent any character used in any known written language. A char value is defined using a character literal, decimal value, […]

February 19, 2010

XML Literals: Escaping Characters

Filed under: VB.NET,XML @ 8:14 pm

In XML, there are several characters that have special meaning, such as the less than (<), greater than (>) and quotation mark ("). If you just type these characters in to your XML literal, your application won’t understand them. NOTE: All of the code in this post is in Visual Basic since C# does not […]

February 9, 2010

ASP.NET: UpdatePanel and Master Pages

Filed under: ASP.NET,C#,VB.NET @ 7:21 pm

I had an ASP.NET page with two UpdatePanel controls. I wanted to handle the page refresh differently depending on whether the user clicked on the button in the first UpdatePanel or whether the click was on the button in the second UpdatePanel. After a little time with Bing, I found the IsInAsyncPostBack and AsyncPostBackSourceElementId properties […]

Next Page »

© 2015 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs