« Home « Chủ đề kĩ thuật lập trình

Chủ đề : kĩ thuật lập trình


Có 100+ tài liệu thuộc chủ đề "kĩ thuật lập trình"

Tiểu trình, tiến trình , và sự đồng bộ phần 2

tailieu.vn

Gọi LongRunningMethod một cách bất đồng bộ. cả ủy nhiệm callback và đối tượng trạng thái bất đồng bộ.. "ready to block...",. DateTime.Now.ToString("HH:mm:ss.ffff"));. Đi vào trạng thái dừng cho đến khi phương thức. thực thi bất đồng bộ kết thúc và thu lấy kết quả.. "complete...", DateTime.Now.ToString("HH:mm:ss.ffff"));. Hiển thị thông tin kết thúc.. Blocking example complete.", completion.ToString("HH:mm:ss.ffff"));. Phương thức PollingExample....

Tiểu trình, tiến trình , và sự đồng bộ phần 3

tailieu.vn

Bạn có thể sử dụng các lớp dẫn xuất từ WaitHandle (đã được thảo luận trong mục 4.2) để gọi thực thi một phương thức. Bằng phương thức RegisterWaitForSingleObject của lớp ThreadPool, bạn có thể đăng ký thể hiện ủy nhiệm WaitOrTimerCallback với thread-pool khi một đối tượng dẫn xuất từ WaitHandle đi vào trạng thái signaled. Bạn có thể...

Tiểu trình, tiến trình , và sự đồng bộ phần 4

tailieu.vn

1.1 Nhận biết khi nào một tiểu trình kết thúc. V V Bạn muốn biết khi nào một tiểu trình đã kết thúc.. Sử dụng thuộc tính IsAlive hay phương thức Join của lớp Thread.. Cách dễ nhất để kiểm tra một tiểu trình đã kết thúc hay chưa là kiểm tra thuộc tính Thread.IsAlive. Thuộc tính này trả về...

Tiểu trình, tiến trình , và sự đồng bộ phần cuối

tailieu.vn

Tạo một đối tượng ProcessStartInfo và cấu hình cho nó. với các thông tin cần thiết để chạy tiến trình mới.. startInfo.FileName = "notepad.exe";. Tạo một đối tượng Process mới.. process.StartInfo = startInfo;. Khởi chạy tiến trình mới.. process.Start();. Đợi tiến trình mới kết thúc trước khi thoát.. Console.WriteLine("Waiting 30 seconds for process to". finish.");. process.WaitForExit(30000);. Console.WriteLine("Could not start process.");....

Windows Form Microsoft .NET Framework phần 1

tailieu.vn

Microsoft .NET Framework chứa một tập phong phú các lớp dùng để tạo các ứng dụng dựa-trên-Windows truyền thống trong không gian tên System.Windows. Các lớp này có phạm vi từ các phần cơ bản như các lớp TextBox, Button, và MainMenu đến các điều kiểm chuyên biệt như TreeView, LinkLabel, và NotifyIcon. Ngoài ra, bạn sẽ tìm thấy tất...

Windows Form Microsoft .NET Framework phần 2

tailieu.vn

Nơi hợp lý để đặt đoạn mã này là trong phương thức thụ lý sự kiện Form.Load.. private void MainForm_Load(object sender, EventArgs e. OpenForms.MainForm = this;. Bạn có thể sử dụng đoạn mã tương tự để gỡ bỏ tham chiếu khi form bị đóng.. private void MainForm_Unload(object sender, EventArgs e. OpenForms.MainForm = null;. Bây giờ, một form khác có thể...

Windows Form Microsoft .NET Framework phần 3

tailieu.vn

using System.Windows.Forms;. System.Windows.Forms.KeyPressEventArgs e. this.SelectedIndex = -1;. this.Text . protected override void OnTextChanged(System.EventArgs e). if (this.Text. string matchText = this.Text;. int match = this.FindString(matchText);. this.SelectedIndex = match;. this.SelectionStart = matchText.Length;. this.SelectionLength. this.Text.Length - this.SelectionStart;. Để thử nghiệm AutoCompleteComboBox, bạn có thể tạo một client đơn giản: thêm ComboBox vào form và thêm một số từ (word) vào ComboBox. using System.Drawing;....

Windows Form Microsoft .NET Framework phần 4

tailieu.vn

1.1 Sử dụng một phần menu chính cho menu ngữ cảnh. V V Bạn cần tạo một menu ngữ cảnh hiển thị các item giống với một số item trong menu chính của ứng dụng.. Sử dụng phương thức CloneMenu của lớp MenuItem để sao lại một phần của menu chính.. Trong nhiều ứng dụng, menu ngữ cảnh của một...

Windows Form Microsoft .NET Framework phần cuối

tailieu.vn

1.1 Thực hiện thao tác kéo-và-thả. V V Bạn cần sử dụng tính năng kéo-và-thả để trao đổi thông tin giữa hai điều kiểm (cũng có thể trong các cửa sổ hoặc các ứng dụng khác nhau). Khởi động thao tác kéo-và-thả bằng phương thức DoDragDrop của lớp Control, và đáp ứng cho sự kiện DragEnter và DragDrop.. Thao tác...

XML phần 1

tailieu.vn

Trong nhiều ứng dụng .NET, bạn sẽ không nhận thấy rằng mình đang sử dụng các kỹ thuật XML—chúng sẽ được sử dụng phía hậu trường khi bạn tuần tự hóa một Microsoft ADO.NET DataSet, gọi một dịch vụ Web XML, hoặc đọc các thiết lập ứng dụng trong một file cấu hình Web.config. Trong các trường hợp khác, bạn...

XML phần 2

tailieu.vn

Tài liệu được tạo ra trông giống như sau:. <productPrice>0.99</productPrice>. 1.1 Chèn thêm nút vào tài liệu XML một cách nhanh chóng. V V Bạn cần chèn thêm nút vào một tài liệu XML mà không phải dùng đến mã lệnh dài dòng.. Viết các phương thức trợ giúp (nhận vào tên thẻ và nội dung của nút) để chèn...

XML phần 3

tailieu.vn

1.1 Đọc và ghi XML mà không phải nạp toàn bộ tài liệu vào bộ nhớ. Để ghi XML, hãy tạo một XmlTextWriter bọc lấy một stream và sử dụng các phương thức Write (như WriteStartElement và WriteEndElement). Để đọc XML, hãy tạo một XmlTextReader bọc lấy một stream và gọi phương thức Read để dịch chuyển từ nút này...

XML phần cuối

tailieu.vn

Dưới đây là cách sử dụng lớp này để xác nhận tính hợp lệ của danh mục sản phẩm:. Console.WriteLine("Validating ProductCatalog.xml.");. bool success = consoleValidator.ValidateXml("ProductCatalog.xml ProductCatalog.xsd");. Nếu tài liệu hợp lệ thì sẽ không có thông báo nào xuất hiện, và biến success sẽ được thiết lập thành true. Nhưng xét xem điều gì sẽ xảy ra nếu bạn sử...

Accessing a Database Using Visual Studio .NET

tailieu.vn

Visual Studio .NET's Server Explorer allows you to use a subset of the features contained in the Databases folder of Enterprise Manager. Specifically, Server Explorer allows you to view, create, and edit databases, database diagrams, tables, views, stored procedures, and user-defined functions. In this section, you'll be introduced to Server Explorer and some of its functionality. As you'll see, Server...

Adding Restrictions to DataTable and DataColumn Objects phần 1

tailieu.vn

Adding Restrictions to DataTable and DataColumn Objects. As you know, a DataSet object is used to store a copy of a subset of the database. For example, you can store a copy of the rows from database tables into a DataSet, with each table represented by a DataTable object. A DataTable stores columns in DataColumn objects.. In addition to storing...

Adding restrictions to datatable and datacolumn objects phần 2

tailieu.vn

isPrimaryKey indicates whether the constraint is a primary key constraint or just a regular unique constraint.. The following example uses the Add() method to add a primary key constraint to the Products DataTable:. myDataSet.Tables["Orders"].Constraints.Add(. "Primary key constraint",. myDataSet.Tables["Orders"].Columns["OrderID". This example does the same thing as the previous example that added the primary key constraint using the PrimaryKey property. Notice the...

Adding Restrictions to DataTable and DataColumn Objects phần 3

tailieu.vn

myDataColumn.ColumnName = OrderID myDataColumn.DataType = System.Int32 myDataColumn.AllowDBNull = False myDataColumn.AutoIncrement = False myDataColumn.AutoIncrementSeed = 0 myDataColumn.AutoIncrementStep = 1 myDataColumn.MaxLength = -1. myDataColumn.ReadOnly = False myDataColumn.Unique = True. myDataColumn.ReadOnly = False myDataColumn.Unique = False. myDataColumn.ColumnName = ProductID myDataColumn.DataType = System.Int32 myDataColumn.AllowDBNull = False myDataColumn.AutoIncrement = False myDataColumn.AutoIncrementSeed = 0 myDataColumn.AutoIncrementStep = 1 myDataColumn.MaxLength = -1. myDataColumn.ColumnName = UnitPrice myDataColumn.DataType = System.Decimal...

Adding, Modifying, and Removing DataRowView Objects from a DataView

tailieu.vn

To add a new DataRowView to a DataView, you call the AddNew() method of your DataView. The AddNew() method returns a DataRowView object that you use to set the column values for the new row.The following example calls the AddNew() method of the customersDV DataView:. DataRowView customerDRV = customersDV.AddNew();. customerDRV.EndEdit();. Notice the use of the EndEdit() method of the customerDRV...

Adding, Updating, and Deleting Related Rows In this section, you'll learn how to make changes in

tailieu.vn

As you'll see, you must push changes to the underlying database tables in a specific order. Note You'll find all the code examples shown in this section in the ModifyingRelatedData.cs program.. customersInsertCommand.Parameters.Add("@CustomerID", SqlDbType.NChar,. 5, "CustomerID");. customersInsertCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 40, "CompanyName");. customersUpdateCommand.Parameters.Add("@NewCompanyName", SqlDbType.NVarChar, 40, "CompanyName");. customersUpdateCommand.Parameters.Add("@OldCustomerID", SqlDbType.NChar, 5, "CustomerID");. customersUpdateCommand.Parameters.Add("@OldCompanyName", SqlDbType.NVarChar, 40, "CompanyName");. customersUpdateCommand.Parameters["@OldCustomerID"].SourceVersion = DataRowVersion.Original;. customersUpdateCommand.Parameters["@OldCompanyName"].SourceVersion = DataRowVersion.Original;. customersDeleteCommand.Parameters.Add("@OldCustomerID", SqlDbType.NChar, 5,...

An Example of Using the Get* Methods phần 1

tailieu.vn

An Example of Using the Get* Methods. To figure out which Get* method to use to retrieve a particular SQL Server column type, you use Table 9.4, shown earlier. For example, the ProductID column is a SQL Server int, and looking up that SQL Server type in Table 9.4, you can see you use the GetInt32() method to obtain the...