This is a very strange error that you can find sometimes when working with ADO.NET.

David McKean from MSFT says:

This occurs when you have multiple DataReaders open concurrently on the same connection, ie you call SqlCommand.ExecuteReader but don't close the SqlDataReader returned by this method before calling it again (either on the same command or another command on the same connection).

It requires a feature called MultipleActiveResultSets which is not available in all providers.

For example SQL2000 does not support it, it was implemented starting from SQL2005.

Visual Basic 6.0 property pages allow you to work around the limitations of the Visual Basic Property Browser. For example, you can use property pages to give users a way to add a collections of colors to a color list user control.

In the property page you would write code that manages the collection, something beyond the capabilities of the Visual Basic Property Browser. In contrast, the Visual Basic .NET Property Browser can be used to edit any .NET variable type or class. Property Pages are no longer needed.

The Upgrade Wizard and the VBUC do not automatically upgrade your Visual Basic 6.0 property pages but they can sure be of help. What if you really what to keep those property pages? Is there any workaround. mmmm Sure there is.

2. Rename the file from .pag to .frm. 3. Remove the .pag from the VB6 project 4. Add the .frm file to the VB6 project 5. Run the VBUC tool.

Once migrated you have a close migration of your original Property Page. Remember however that some things change in .NET and you will need to manually finish some details. For example, you need to review code in the PropertyPage_ApplyChanges(), PropertyPage_EditProperty(PropertyName As String) PropertyPage_SelectionChanged().

Ok. Once you take your Property Page to .NET how do you integrate it with your control. Well that’s easy. There you could create a ControlDesigner or just use an UITypeEditor.

Let’s see the UITypeEditor aproach.

The general idea with this aproach is to provide an UITypeEditor (this is just a way to provide an editor in the property Browser that is not supported by default. And taking advantage of that editor we will show the form that was produced after migrating out Property Pages. If you want an interface more similar to what you had on Visual Basic 6.0 you can modify the property page and add a TabControl.

Ok. So these are the steps to follow:

1. First you need to create a type for which you will provide a Type Editor. We will call this type CustomData

5. In the previous put attention to the highlighted details. What we are doing is getting a reference to the WindowsFormEditor service so we property open the PropertyPage that has now been turned into a form. It is important that you add a public property to the migrated PropertyPage like:

public MyControl control { get; set; };

because that will give you a reference to the actual control that is on the form. The property page is just an interface you will need to set the values into properties on your control, in order for them to be serialized.

6. Once you do that, when you see the property editor for your control you will see something like:

While solving a bug with a custom class that extended the System.Data.DataSet class, I found a situation where the class implemented, the ISerializable interface, but for some reason, during the call to the base.GetObjectData in my serialization code it was trying to get the value of some properties that caused an exception.

The reason was that those properties were not “ready” because my serialization code had not finish initializing the object. But why was the Dataset.GetObjectData trying to get or set those values.

It seems that there is some code in the dataset that used reflection to get the object properties and try to serialize them. I did not want that. How could I stop the framework from doing that?

I thought of the NonSerializable attribute but that works only on fields and what I have is a property.

I thought of the XmlIgnore attribute but it had no effect.

Why!!!!

Well I finally found that you can add a couple of (not attributes) methods to your component.

They should be named Reset<Property>() and ShouldSerialize<Property>() and returning a boolean value from these functions will control if the properties are serialized or not.

Please invoke the Registry editor, add the "HideMenu" DWORD value to the following Registry key, and set its Value to 0: HKEY_LOCAL_MACHINE\SOFTWARE\Developer Express\CodeRush for VS\9.1 This should make the "DevExpress" menu visible.

.NET has been around for quite a while. According Wikipedia it has been around since on 3 April 2003. So now there exist applications developed for .NET Framework 1.0 or 1.1 and people need to migrate them to Framework 2.0 or Framework 3.5.

It is the general impression that there is not a direct path to 3.5. As Zain Naboulsi explains in his blog you can go from 1.1 to 2.0 then from 2.0 to 3.5. And From 2.0 to 3.5 the migration is a no-brainer because, both, 3.0 and 3.5 are based on 2.0.

The VBCompanion provides excellent helpers that provide a lot fo the VB6 Printer object functionality, so you dont have to change any of your actual code, but in some cases, you might just want to remove that code, specially for very specific things like printing a RichTextBox.

So here I’m providing a .NET simplified helper that allows you to print the contents of a RichTextBox control. This helper is just based on the code published by Martin Muller in http://msdn.microsoft.com/en-us/library/ms996492.aspx. It provides an extension method for VS 2008 user so all you have to do is call RichTextBox.Print.

The implementation is simple. The RichTextBoxPrintHelper creates or receives an instance of a PrintDocument object, and event handlers are added to it for the BeginPrint, PrintPage and EndPrint events.

privateint m_nFirstCharOnPage;
privatevoid printDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
// Start at the beginning of the text
m_nFirstCharOnPage = 0;
}
privatevoid printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// To print the boundaries of the current page margins// uncomment the next line://e.Graphics.DrawRectangle(System.Drawing.Pens.Blue, e.MarginBounds);// make the RichTextBoxEx calculate and render as much text as will// fit on the page and remember the last character printed for the// beginning of the next page
m_nFirstCharOnPage = FormatRange(false,
e,
m_nFirstCharOnPage,
control.TextLength);
// check if there are more pages to printif (m_nFirstCharOnPage < control.TextLength)
e.HasMorePages = true;
else
e.HasMorePages = false;
}
privatevoid printDocument_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
// Clean up cached information
FormatRangeDone();
}

The FormatRange method is called. This method will use the fill out some structures with page information and use the RichTextBox handle to send messages that will renderthe control contents to the Printer’s HDC.