... editions, contact your local Microsoft Corporation office or contact Microsoft
Press International directly at fax (425) 936-7329. Visit our Web site at www .microsoft. com/mspress.
Send comments ... that Microsoft software product support is not offered through the
above addresses.
18 Part I Introducing MicrosoftVisual C# and MicrosoftVisual Studio 2008
code and logic for a graphical ... Studio 2008 Enterprise Edition,
or MicrosoftVisual C# 2008 Express Edition and MicrosoftVisual Web Developer 2008
Express Edition
Microsoft SQL Server 2005 Express Edition, Service Pack 2
...
... brightly colored clothes.
Christian Nagel is a software architect, trainer, and consultant, and an associate of Thinktecture
(
www.thinktecture.com), offering training and coaching based on Microsoft ...
PC since the early 1990s using various languages, including Pascal, Visual Basic, C/ C++, and C# . Jacob
has co-authored a number of .NET books and works with a wide variety of Microsoft technologies, ... specifically the
chapters on collections, generics, and C# 3.0 language additions (Chapters 11 to 14 ), or skip the first
section of the book completely and start with Chapter 15 .
The chapters...
... can place
identical (or near identical) sections of code in your application whenever necessary, but this has
its own problems. Changing even one minor detail concerning a common task (to correct ... function for a console application. When a C#
application is executed, the entry point function it contains is called; and when this function is
completed, the application terminates. All C# ... application that accepts a string from the user and outputs a string with the
characters in reverse order.
6. Write a console application that accepts a string and replaces all occurrences...
... project is called Ch10CardClient.
To use the class library you have created from this new console application project, add a reference to
your Ch10CardLib class library project. Once the console ... Both your classes and your enumerations will be contained in a class library project called Ch10CardLib.
This project will contain four
.cs files: Card.cs , which contains the Card class definition, ... interfaces that require
implementation.
5. Create a console application project, Traffic, that references Vehicles.dll (created in question
4). Include a function called
AddPassenger that accepts...
... 3. Select the Animal.cs , Cow.cs , Chicken.cs , SuperCow.cs , and Farm.cs files from the
C: \BegVCSharp\Chapter12\Ch12Ex04\Ch12Ex04 directory, and click Add.
4. Modify the namespace declaration ... follows:
namespace Ch14Ex01
5. Add a default constructor to the Cow , Chicken , and SuperCow classes. For example, for Cow
add the following code:
namespace Ch14Ex01
{
public class Cow : Animal
... application called Ch13Ex03 and save it in the directory
C: \BegVCSharp\Chapter13.
2. Copy the code across for Program.cs , Connection.cs , and Display.cs from Ch13Ex02,
making sure that you change...
... PM
Chapter 16: Advanced Windows Forms Features
525
This chapter focuses on user controls, because designing and drawing a custom control from scratch is
beyond the scope of this book. Chapter ... container:
public frmContainer()
{
InitializeComponent();
// Create a new instance of the child form.
MdiBasic.frmChild child = new MdiBasic.frmChild(this);
// Show the form.
child.Show();
}
... You create a new instance of the child class and pass this to the constructor, where this represents
the current instance of the MDI container class. Then you call
Show() on the new instance...
... EventsDataSource for this new data source.
Figure 19-25
6. Click OK to configure the data source. The Configure Data Source dialog opens. Click the
New Connection button to create a new connection. ... data source.
ObjectDataSource Enables you to use .NET classes as the data source .
XmlDataSource Enables you to access XML files. Using this data source, hierarchical
structures can be displayed. ... successfully created, click the Next button for step 6 of the wizard (see Figure
19 - 17 ). Here, you can configure which users are allowed or denied access to the Web site or
specific directories....
... such as characters:
Decoder d = Encoding.UTF8.GetDecoder();
d.GetChars(byData, 0, byData.Length, charData, 0);
These lines create a Decoder object based on the UTF - 8 encoding schema, which ... public Form1()
{
DirectoryInfo aDir = new DirectoryInfo(@ C: \FileLogs”);
if (!aDir.Exists)
aDir.Create();
}
11. Create a directory called C: \TempWatch and a file in this directory called ... Run the application. If everything builds successfully, click the Browse button and select
C: \TempWatch\temp.txt.
13. Click the Watch button to begin monitoring the file. The only change you...
... Open connection
thisConnection.Open();
// Create command for this connection
SqlCommand thisCommand = thisConnection.CreateCommand();
// Specify SQL query for this command
thisCommand.CommandText ... @”Provider =Microsoft. Jet.OLEDB.4.0;Data Source =C: \Northwind\nwind.mdb”);
// Open connection object
thisConnection.Open();
// Create SQL command object on this connection
OleDbCommand thisCommand ... Create connection object for Microsoft Access OLE DB Provider;
// note @ sign prefacing string literal so backslashes in path name;
// work
OleDbConnection thisConnection = new OleDbConnection(
...
...
WebClient class.
Try It Out Using the WebClient Class
1.
Create a new Console Application project named WebClientDemo in the directory
C: \BegVCSharp\Chapter32.
2. Import the namespace ... following code to the Main() method:
static void Main()
{
WebClient client = new WebClient();
client.BaseAddress = “http://www .microsoft. com”;
string data = client.DownloadString(“Office”);
Console.WriteLine(data);
... Techniques
1060
Try It Out Adding XML Documentation in a Class Diagram
1.
Create a new class library application called DiagrammaticDocumentation and save it in the
directory C: \BegVCSharp\Chapter31....
... here.
PropertyChangedCallback
propertyChangedCallback
The callback method to use when the property value
changes .
CoerceValueCallback
coerceValueCallback
The callback method to use ... Simple WCF Service and Client
1.
Create a new WCF Service Application project called Ch35Ex01 in the directory
C: \BegVCSharp\Chapter35.
2. Add a console application called Ch35Ex01Client ... communicate with WCF services from anywhere, including across
the Internet. You can use HTTP communications to create WCF Web services.
TCP: This enables you to communicate with WCF services...
... some of the C# code automatically generated by Visual Studio
2008 to implement these controls.
22 Part I Introducing MicrosoftVisual C# and MicrosoftVisual Studio 2008
Notice that the text ... editions, contact your local Microsoft Corporation office or contact Microsoft
Press International directly at fax (425) 936-7329. Visit our Web site at www .microsoft. com/mspress.
Send comments ... that Microsoft software product support is not offered through the
above addresses.
iii
Contents at a Glance
Part I Introducing MicrosoftVisual C# and
Microsoft Visual Studio 2008
1 Welcome...