In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use VB.NET data form, the article is very detailed, has a certain reference value, interested friends must read it!
You can quickly get the file manipulator form using the VB.NET data forms Wizard (Data Form Wizard). To use it, select Add New Item from the Project menu, and then select Data Form (VB.NET data form). The wizard will help you specify the data you want step by step and set up a file operation program for that data.
But this automatic generator has an important limitation. If there are any fields in the accessed data that cannot be empty (because the database outline does not allow null values), the program generated by the wizard cannot add records. When you click the Add button, an error message will appear indicating that * fields in the record are not allowed to be empty (if you do not have a * service pack, you may not see the error message, but the program refuses to add the record).
The problem is that the VB.NET data forms wizard uses the BindingContext object to add a row to the bound data table. Here is the code for the failure of the btnAdd_Click event program:
Me.BindingContext (objProducts, "Products"). AddNew ()
The workaround is to skip the BindingContext object for the new row. The following is a typical code for adding a new line, which should replace the line above:
Dim dr As DataRow dr = objProducts.Tables ("Products"). NewRow dr.Item ("ProductName") = "dr.Item (" Discontinued ") = False 'Set any other fields that cannot null to default values. ObjProducts.Tables ("Products") .Rows.Add (dr)
When you get a blank row using the NewRow method of the data table, the code populates the fields that cannot be empty with values. The datasheet then accepts new rows and adds new rows through the Add method of the datasheet row set.
With this patch, the data program can run. It can be enhanced or changed, such as changing the SupplierID and CategoryID fields to select from a drop-down list that contains suppliers and categories.
The above is all the contents of the article "how to use VB.NET data forms". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.