This is a C# post.
I'm using VB.NET to create an add-in for the Google Sidebar, and have
implemented the OnDetailsView method.
NOTE : I've come across this same problem (error message) even in C#.
I tried placing a label control and setting the reference of this new
lable into the 'details_control' parameter.
This worked.
How ever, when i tried creating a textbox control and setting the
reference of this textbox to details_control I got the below error
message (NOTE : I tried this even with a user control, button and panel
- but all gave the same error message).
Below is the error message:
-------------------------------------------------------------------
An unhandled except has occurred in a compnent in your application.
Click continue and application will ignore this error and attemp to
continue.
Object reference not set to an instance of an object.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance
of an object.
at System.Windows.Forms.ActiveXImpl.InPlaceActivate(I nt32 verb)
at System.Windows.Forms.ActiveXImpl.InPlaceActivate(I nt32 verb)
at System.Windows.Forms.ActiveXImpl.OnFocus(Boolean focus)
at System.Windows.Forms.ActiveXImpl.OnFocus(Boolean focus)
at System.Windows.Forms.Control.ActiveXOnFocus(Boolea n focus)
at System.Windows.Forms.Control.OnGotFocus(EventArgs e)
at System.Windows.Forms.TextBox.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WmSetFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at
System.Windows.Forms.ActiveXImpl.System.Windows.Fo rms.IWindowTarget.OnMessa*ge(Message&
m)
at
System.Windows.Forms.ActiveXImpl.System.Windows.Fo rms.IWindowTarget.OnMessa*ge(Message&
m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
GoogleDesktopDisplayVBSample
Assembly Version: 1.0.2113.34762
Win32 Version: 1.0.2113.34762
CodeBase:
file:///D:/Development/VB.NET/Learn/Temp/WindowsApplication1/bin/GoogleDesk*topDisplayVBSample.DLL
----------------------------------------
Interop.GoogleDesktopDisplayLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Development/VB.NET/Learn/Temp/WindowsApplication1/bin/Interop.Go*ogleDesktopDisplayLib.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c5619*34e089/system.windows.forms.dll
----------------------------------------
stdole
Assembly Version: 7.0.3300.0
Win32 Version: 7.00.9466
CodeBase:
file:///c:/windows/assembly/gac/stdole/7.0.3300.0__b03f5f7f11d50a3a/stdole.*dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase:
file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f1*1d50a3a/microsoft.visualbasic.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.*dll
----------------------------------------
GoogleDesktopDisplayCSharpSample
Assembly Version: 1.0.2114.33663
Win32 Version: 1.0.2114.33663
CodeBase:
file:///D:/Development/GD_SDK/api/samples/GoogleDesktopDisplayCSharpSample/*bin/Debug/GoogleDesktopDisplayCSharpSample.DLL
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a*/system.drawing.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
-------------------------------------------------------------------
Below is the code i used to place a label and a textbox on the detail
view of the content item.
This works, how ever, if i use a textbox, button, user control or any
other control i get the above error message.
public new bool OnDetailsView(out string title,
out GoogleDesktopDisplayDetailsViewFlags flags, out object detailsControl) {
Label loLabel = new Label();
loLabel.Text = "Hello there";
detailsControl = loLabel;//details;
title = heading;
flags =
GoogleDesktopDisplayDetailsViewFlags.GDD_DETAILS_V IEW_FLAG_TOOLBAR_OPEN |
GoogleDesktopDisplayDetailsViewFlags.GDD_DETAILS_V IEW_FLAG_NEGATIVE_FEEDBACK;
return false; // return false to show details view, true to cancel it.
}