Cách đưa ra câu hỏi xác nhận việc xóa một dòng dữ liệu khi bạn click nút xóa trên BindingNavigator tự phát sinh khi bạn kéo DataSource và form design (phát sinh mã tự động)
In order to add new records into a dataset, a new data row must be created and added to the DataRow collection of a data table. The following procedure details how to insert additional rows into a DataTable object in a dataset. For this example, it is assumed the ExistingTable is in a dataset and has two columns named FirstName and LastName.
Call a data table’s NewRow method to create a new, blank record. This new record inherits its column structure from the data table’s DataColumnCollection.
' Visual Basic
Dim anyRow as DataRow = ExistingTable.NewRow
// C#
DataRow anyRow = ExistingTable.NewRow();
Update the new row as if it were an existing record.
' Visual Basic
anyRow(0) = "Money"
anyRow(1) = "Phan"
' or
anyRow("FirstName") = "Money"
anyRow("LastName") = "Phan"
// C#
anyRow[0] = “Money”;
anyRow[1] = “Phan”;
// or
anyRow["FirstName"] = “Money”;
anyRow["LastName"] = “Phan”;
Inserting New Records with Typed Datasets
' Visual Basic
ExistingTable.Rows.Add(anyRow)
// C#
ExistingTable.Rows.Add(anyRow);
* The following example illustrates the same three steps above, except this time the code is modified for use with a typed dataset:
' Visual Basic
Dim anyRow as DataRow = DatasetName.ExistingTable.NewRow
anyRow.FirstName = "Jay"
anyRow.LastName = "Stevens"
ExistingTable.Rows.Add(anyRow)
// C#
DataRow anyRow = DatasetName.ExistingTable.NewRow();
anyRow.FirstName = "Jay";
anyRow.LastName = "Stevens";
ExistingTable.Rows.Add(anyRow);
Replaces the format item in a specified String with the text equivalent of the value of a specified Object instance.
The following code example demonstrates the standard formatting specifiers for numbers, dates, and enumerations.
VB.NET
C#.NET
The web.config file in ASP.NET is the central location for your web applications configuration. It contains settings such as authentication, handler settings, compilation settings, globalization settings, tracing and error settings, etc… But what happens when this is not enough? Or you want to add you own settings into the web.config file. This tutorial will explain how it’s done. To create your own custom configuration handler, it will require two parts: writing some code, and editing your web.config file.
The code
Here we have a small C# file with code to create a new handler that will be used in the web.config file.
There are two classes here, the PageStyleHandler class which implements the IConfigurationSectionHandler, and the PageStyle class which is used to store and retrieve the configuration data.
The PageStyleHandler contains the Create method. It is used to create and instance of the PageStyle class to pass the data from the web.config file.
The PageStyle class will accept an XML node which comes from the web.config file, it reads the attribute from the XML node and it will save the data for future retrieval by the BackColour property.
The web.config file
To add your custom handler to the web.config file for this application, it requires simply editing the web.config file so that it will accept your new handler. Your new web.config file will look like this:
Note that this example will only apply to the web application that this file resides in. If you would like this new handler to apply to all web applications on this server, the
An example usage in an ASPX page
Here is an example of our new custom handler in action:
The custom configuration handler in ASP.NET is a useful addition for creating really flexible web pages. Usage for custom configuration handlers can be for: allowing the web applications style to be defined in one web.config file, saving information that is commonly used (ie. DSN), and whatever else you can think of.
Copyright © 2001 Andrew Ma. at devhood.com
All kinds of Third party controls exists to make a tabbed MDI possible. But (Vietnamese as I am) was looking for a good looking, free alternative. I came across DockPanel suite. Dockpanel suite is much more than a tabbed MDI only .
it’s possible to dock panels exactly like in VS.NET 2005. (with the nice looking, user friendly navigation)
VB.NET cũng có hàm SaveSetting, GetSetting như VB6 giúp bạn thao tác với Resgistry, nhưng 2 hàm này chỉ thao tác tại một Location nhất định (location dành riêng cho ứng dụng). Nếu bạn muốn thao tác tai các location khác thì dùng 2 hàm này.
Hôm nay mình đụng phải một đoạn code UPDATE dữ liệu vào Database MS Access. Khi chạy, nó không hề báo lỗi gì cả nhưng dữ liệu không được Update. Đau đầu, tốn nhiều thời gian cho nó một cách thật bực mình.