Reading the Data and Schema

Before the control does anything, it has to be able to read the schema from the database based on the Select statement. Let’s create a public subprocedure and call it ReadData. We want the procedure to behave a little differently when the control is displayed in a form designer than when it is running in an application. When the control is in a designer, we don’t want to read data from the database. What we really want to do is to read the schema. The DataAdapter has a method just for this purpose called FillSchema. The question is, how do we detect if the control is in a designer or in design mode?

If you never developed controls in VB 6, you might be wondering what the heck I’m talking about. This can get a little ...

Get ADO.NET Programming in Visual Basic™ .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.