... 7-12 UsePartofaMainMenuforaContextMenu 336 7-13 Make a Multilingual Form 338 7-14 Create a Form That Cannot Be Moved 341 7-15 Make a Borderless Form Movable ... portfolio management, strategic planning, and real-time search Allen is a partner at QuantumBlack, a design and technology studio that applies visual analytics to help organizations make faster decisions ... Application Domain 111 3-6 Execute an Assembly in a Different Application Domain 114 3-7 Instantiate a Type in a Different Application Domain 116 3-8 Pass Data Between Application...
... // A private class used to pass initialization data to a new thread private class ThreadStartData { public ThreadStartData(int iterations, string message, int delay) { this.iterations = iterations; ... each message fora specified duration private static void DisplayMessage(object config) { ThreadStartData data = config as ThreadStartData; if (data != null) { for (int count = 0; count < data.Iterations; ... a WaitSleepJoin state and wait for any one of the objects in a WaitHandle array to be signaled You can also specify a timeout value WaitAll 178 Description A static method that causes the calling...
... search an XML document for nodes using advanced search criteria For example, you might want to search a particular branch of an XML document for nodes that have certain attributes or contain a specific ... will indicate each error: Validating ProductCatalog_Invalid.xml Validation error: The 'expiryDate' element has an invalid value according to its data type [path information truncated] Validation ... functionality The separation of generated and manual code is particularly elegant in Visual Studio 2005 and later versions due to the extensive useof partial types 308 CHAPTER ■ WINDOWS FORMS 7-1 Add...
... class For example, you could store an array of image data, some content that should be used as a header or footer on each page, font information, or even the name ofa file from which you want ... System.Drawing.Drawing2D; namespace Apress.VisualCSharpRecipes.Chapter08 { public partial class Recipe08_02 : Form { // Define the shapes used on this form private GraphicsPath path; private Rectangle ... allow users to navigate to a web page whose address is entered into a TextBox Buttons also allow users to move forward and backward through page history and navigate directly to their personal...
... Create the data set DataSet dataset = new DataSet(); 469 CHAPTER ■ DATABASE ACCESS // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command ... to obtain an instance of DataRow that has the same schema as the DataTable The new row is not automatically added to the table 462 CHAPTER ■ DATABASE ACCESS when you call NewRow—call DataTable.Rows.Add ... System.String Data in table Data Eastern Data Western Data Northern Data Southern Data in (modified) table Data North Eastern Data Western Data Northern Data Southern Data Central Main method complete...
... current application domain AppDomain appDomain = System.AppDomain.CurrentDomain; // Configure the current application domain to use Windows-based principals appDomain.SetPrincipalPolicy( System.Security.Principal.PrincipalPolicy.WindowsPrincipal); ... maintain access to the original data To determine if data changes over time, you must generate and store the original data’s hash code Later, you can generate another hash code for the data and ... command-line argument HashAlgorithm hashAlg = null; if (args[0].CompareTo("SHA1Managed") == 0) { hashAlg = new SHA1Managed(); } else { hashAlg = HashAlgorithm.Create(args[0]); } using (hashAlg)...
... defines a type called MyDataType, which has a constructor and a method called sayHello The Main method called when the application starts creates an instance of MyDataType using eager initialization, ... event argument classes.) namespace Apress.VisualCSharpRecipes.Chapter13 { // An event argument class that contains information about a temperature // change event An instance of this class is passed ... finalizer can take the necessary steps to release any unmanaged resources Unfortunately, because the garbage collector uses a single thread to execute all finalizers, useof finalizers can have a detrimental...
... scale the image at all If the image is smaller than the area of the shape, the rest of the area is left empty (transparent fill) If the image is larger than the shape, the image is cropped Uniform ... cvsSurface_Drop(object sender, DragEventArgs e) { // Create a new Label Label newLabel = new Label(); newLabel.Content = e.Data.GetData(DataFormats.Text); newLabel.FontSize = 14; // Add the Label ... coordinates ofa pair with a comma and separate each coordinate pair with a space (for example, x1,y1 x2,y2 x3,y3, and so on) To configure the points ofa Polygon programmatically, you need to add System.Windows.Point...
... class For example, you could store an array of image data, some content that should be used as a header or footer on each page, font information, or even the name ofa file from which you want ... System.Drawing.Drawing2D; namespace Apress.VisualCSharpRecipes.Chapter08 { public partial class Recipe08_02 : Form { // Define the shapes used on this form private GraphicsPath path; private Rectangle ... allow users to navigate to a web page whose address is entered into a TextBox Buttons also allow users to move forward and backward through page history and navigate directly to their personal...
... Create the data set DataSet dataset = new DataSet(); 469 CHAPTER ■ DATABASE ACCESS // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command ... to obtain an instance of DataRow that has the same schema as the DataTable The new row is not automatically added to the table 462 CHAPTER ■ DATABASE ACCESS when you call NewRow—call DataTable.Rows.Add ... System.String Data in table Data Eastern Data Western Data Northern Data Southern Data in (modified) table Data North Eastern Data Western Data Northern Data Southern Data Central Main method complete...
... current application domain AppDomain appDomain = System.AppDomain.CurrentDomain; // Configure the current application domain to use Windows-based principals appDomain.SetPrincipalPolicy( System.Security.Principal.PrincipalPolicy.WindowsPrincipal); ... maintain access to the original data To determine if data changes over time, you must generate and store the original data’s hash code Later, you can generate another hash code for the data and ... command-line argument HashAlgorithm hashAlg = null; if (args[0].CompareTo("SHA1Managed") == 0) { hashAlg = new SHA1Managed(); } else { hashAlg = HashAlgorithm.Create(args[0]); } using (hashAlg)...
... defines a type called MyDataType, which has a constructor and a method called sayHello The Main method called when the application starts creates an instance of MyDataType using eager initialization, ... event argument classes.) namespace Apress.VisualCSharpRecipes.Chapter13 { // An event argument class that contains information about a temperature // change event An instance of this class is passed ... finalizer can take the necessary steps to release any unmanaged resources Unfortunately, because the garbage collector uses a single thread to execute all finalizers, useof finalizers can have a detrimental...
... // A private class used to pass initialization data to a new thread private class ThreadStartData { public ThreadStartData(int iterations, string message, int delay) { this.iterations = iterations; ... each message fora specified duration private static void DisplayMessage(object config) { ThreadStartData data = config as ThreadStartData; if (data != null) { for (int count = 0; count < data.Iterations; ... a WaitSleepJoin state and wait for any one of the objects in a WaitHandle array to be signaled You can also specify a timeout value WaitAll 178 Description A static method that causes the calling...
... CultureInfo.CurrentCulture.NativeName; } // Sample data that might come from a database // displayed according to culture set by user dateLabel.Text = DateTime.Now.ToString("D"); shortDateLabel.Text = DateTime.Now.ToString("d"); ... classes which makes this relatively easy The System.Globalization namespace contains classes that specify culture-related information These classes are useful in writing globalized applications Within ... information fora user You can store it persistently on the client in a cookie Or you can store it in a database on the server and store it to a session variable when the client logs in or on an...
... classes o The namespace Visual Studio 2005 has used the name of the project as the name of the toplevel namespace: namespace WinFormHello { } o A class Visual Studio 2005 has written a class ... Windows Forms application, Visual Studio 2005 actually generates a potentially large amount of code This code performs operations such as creating and displaying the form when the application starts, ... previous example) For example: using System.Windows.Forms; The additional namespaces contain the classes and controls used when building graphical applications for example, the TextBox, Label, and Button...
... Create DataAdapter Objects 384 Lesson 4: Working with Data in DataTable Objects 385 Adding Data to a DataTable 385 Editing Data in a DataTable 386 Deleting Data in a DataTable ... DataView 410 Searching Data in a DataView 410 Navigating Related Data in a DataView 411 Working with DataView Events 411 Setting the DataTable Object’s Default Table Views Using a DataViewManager ... represents a type of form and creating an instance of that form To add a form to your application at run time, declare and instantiate a variable that represents your form This example assumes that you...
... pride and joy—his son, Nathan Brian is a fellow Microsoft Regional Director and Microsoft MVP Brian is a fantastic author and speaker and one heck ofa great software architect There are only a few ... systems for more than sixteen years He speaks at many major software conferences around the world, and writes fora variety of software journals and magazines He lives in Alexandria, Virginia, but ... best kind of client application for most users is an application with a graphical user interface What Is a Smart Client Application? Smart clients are a subset of all the Windows applications running...
... containing the image from the database Create a SQL statement to retrieve the required image from the database and retrieve the image using a DataReader A DataTable or DataSet filled using a DataAdapter ... the image as a binary stream The BinaryWrite( ) method of the HttpResponse object writes a stream of binary characters to the HTTP output stream rather than a textual stream Response.BinaryWrite((byte[])dr["Photo"]); ... but not straightforward Fortunately, it is much simpler with ASP.NET than it was in ASP Two web pages are required: one that contains the user interface that the client sees and one that retrieves...
... if(!Page.IsPostBack) { dataGrid.DataSource = CreateDataSource( ); dataGrid.DataKeyField = "Id"; dataGrid.DataBind( ); } private DataTable CreateDataSource( ) { DataTable dt = new DataTable(TABLENAME); ... fills a DataTable with the TBL0705 table and stores the DataTable to a Session variable to cache the data source for the DataGrid UpdateDataSource( ) This method creates a DataAdapter and uses ... UpdateDataSource(DataTable dt) { // Create a DataAdapter for the update SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM " + TABLENAME + " ORDER BY Id", ConfigurationSettings.AppSettings["DataConnectString"]);...
... to the DataGrid The MappingName property of the DataGridTableStyle is set to the DataSource The MappingName of each DataGridColumnStyle object must be associated with the name ofa DataColumn ... attributes, display format, and behavior of cells in a DataGrid column At runtime, each cell in the column hosts a DataGridTextBox control The DataGridBoolColumn inherits from the abstract DataGridColumnStyle ... DataGrid display column with the data column An exception will be thrown if duplicate mapping names are used The DataGridTextBoxColumn class inherits from the abstract DataGridColumnStyle class...