WIA & C#: TypeDescriptionProvider.GetTypeDescriptor() instance parameter is null?

Hello,

I'm implementing an application with C# and WIA scripting and I'm
trying to display a WIA Device object in a property grid.  After some
searching it seems like I want to model my solution after this example
(http://msdn.microsoft.com/en-us/magazine/cc163804.aspx) that involves
implementing a TypeDescriptionProvider and registering it via
TypeDescriptor.AddProvider().

When I set my Device object as the SelectedObject in my property grid,
I trace the through my implementation of "public override
ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object
instance)" but the instance parameter is null.  This is unfortunate
since I need the instance to make the following calls to the WIA
Device's properties to generate the displayed properties in the
TypeDescriptor.

Could anybody help me?  Why would the instance be null?  And what
could I do to fix it, or work around it?

Thanks!
0
Edward
11/14/2009 10:51:13 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
1561 Views

Similar Articles

[PageSpeed] 42

In article <8851410d-e2d2-468b-8e91-eb6c3dae4820
@g1g2000vbr.googlegroups.com>, beach9000@hotmail.com says...
> 
> Hello,
> 
> I'm implementing an application with C# and WIA scripting and I'm
> trying to display a WIA Device object in a property grid.  After some
> searching it seems like I want to model my solution after this example
> (http://msdn.microsoft.com/en-us/magazine/cc163804.aspx) that involves
> implementing a TypeDescriptionProvider and registering it via
> TypeDescriptor.AddProvider().
> 
> When I set my Device object as the SelectedObject in my property grid,
> I trace the through my implementation of "public override
> ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object
> instance)" but the instance parameter is null.  This is unfortunate
> since I need the instance to make the following calls to the WIA
> Device's properties to generate the displayed properties in the
> TypeDescriptor.
> 
> Could anybody help me?  Why would the instance be null?  And what
> could I do to fix it, or work around it?
> 
> Thanks!


I didn't use this approach but may I ask why do you need the instance 
for?

Don't you already know all the definitions of properties at design time?

I've implemented ICustomTypeDescriptor and all you know is your type. 
Whan PropertyGrid gathers the values of an instance it will call 
GetValue() passing "component" which holds the instance you need to get 
tha actual value.


-- 
dobro promijesajte kavu da ne ostanu grumeni
0
Smola
11/15/2009 9:37:30 AM
Reply:

Similar Artilces:

NZ Function and Null VS 0 values
Here is my question, I have the following statment in a query: PostSumCreated: Sum(NZ([Post_Sec2_7CreatedTotal]) +NZ([Post_Sec3_5CreatedTotal])+NZ([Post_Sec4_3CreatedTotal]) +NZ([Post_Sec4_5CreatedTotal])+NZ([Post_Sec5_4CreatedTotal]) +NZ([Post_Sec6_7CreatedTotal])+NZ([Post_Sec7_4CreatedTotal])) This returns either the number of the addition or 0. The problem is that I have NULL values in the table, where 0 would represent that yes nothing was done and Null would represent that nothing was support to happen. What I need help with is trying to add the needed columns if they have a value >...

File Start-up Parameters
How do I send Excel parameters from a hyperlink to display "Sheet1" and another hyperlink to open the same file to "Sheet3"? Are you hyperlinking from within a MS Office app? If so, you can hyperlink to a specific cell/worksheet/workbook. Whst specific problem are you having? -- Greeting from the Gulf Coast! http://myweb.cableone.net/twodays "John French" <john.french@rogers.com> wrote in message news:081801c3815c$7e138a50$a401280a@phx.gbl... > How do I send Excel parameters from a hyperlink to > display "Sheet1" and another hyperlink to...

Does GP need its own instance?
Hello, We were recently adviced that we should consolidate our SQL Server 2003 instances except for applications that use the system databases. Does Great Plains make any changes that might interfere with other applications on the same instance? Thanks, -- Brian Francis Not that I am aware of. We have had plenty of apps share with GP instances. I do however prefer it to be alone because if we have to stop and start SQL services we only have to worry about the GP users "bfrancis" wrote: > Hello, > > We were recently adviced that we should consolidate our SQL Serv...

Xml validation exception only occurs outside debugger
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger (debug or release) I receive the following error: "The type initializer for "System.Xml.Schema.Validator" threw an exception." I wrote a small console app that contains the problem -- I've just attached the default class which gets run. Output outside the debugger is as follows ------------------ Creating xml file Reading xml file Error reading xml file The type initializer for "Syst...

OleDb SqlDataSource stored procedure call parameter order mixed up ?
I am using a OleDb SqlDataSource to bind to a GridView The SqlDataSource is defined as follows: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ProviderName="System.Data.OleDb" ... UpdateCommand="mp_Update" UpdateCommandType = "StoredProcedure" ... > <UpdateParameters> <asp:Parameter Name="@ret_val" Type="Int32" Direction=ReturnValue /> <asp:Parameter Name="usr_id" Type="String" Size="32&qu...

Disappearing C
We use Excel 2002. It's been working beautifully. Today, when we type the letter "c" as the only entry in a cell, it disappears after we go to the next cell. Any suggestions? Thanks a bunch. Hi Stacey! You may want to check the ff: Tools>AutoCorrect Options... in the Replace-With portion, verify if C is equivalent to (space). Scroll down to see additional entries as necessary. If C is indeed equivalent to (space) or blank, press DELETE then OK. Hope this helps! -- Thanks and kind regards "Stacey" wrote: > We use Excel 2002. It's been working ...

NULL Value in XML Schema
Hi All, How to define an XML element with no value and no attribute? <X> <Y/> </X> And Y has no value? I've done it with: <xsi:element name="Y" type="rn:T_NULL"/> <xsi:simpleType name="rn:T_NULL"> <xsi:restriction base="xsi:string" length="0"/> </xsi:simpleType> But it seems too complicated. Thanks, Reuven Reuven Nisser wrote: > How to define an XML element with no value and no attribute? > > <X> > <Y/> > </X> > > And Y has no value? > &g...

plugin object in C#
How can I make plugin object in C# ? Thanks :) On 12-05-2010 15:20, Mr. X. wrote: > How can I make plugin object in C# ? ..NET has excellent possibilities for creating plugins. From simple load of class and instantiation via reflection over use og IoC framework like Spring.NET and a config file to the huge add-in framework. Arne Give me an example, please. Thanks :) "Arne Vajhøj" <arne@vajhoej.dk> wrote in message news:4beb07d2$0$280$14726298@news.sunsite.dk... > On 12-05-2010 15:20, Mr. X. wrote: >> How can I make plugin object in C# ...

Help with passing a string variable into a parameter
hello! here is my problem. I have built a dynamic string called @filepath as char50 i need to place it in: SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', @filePath, 'SELECT * FROM [Sheet1$]') does any one know the correct syntax??? for passing a parameter here OPENROWSET does not accept variables as arguments. You have to use dynamic SQL to build your query (append the @filePath) and execute. -- Plamen Ratchev http://www.SQLStudio.com On Mar 11, 1:25=A0pm, Plamen Ratchev <Pla...@SQLStudio.com> wrote: > OPENROWSET does not accept variab...

Skip Query Parameter
Dear All I Have a combo box that is feeding a query parameter to filter some rows. sometimes I want to view all records. the row source for this combo box is a table assigned only for that. and I want to add this option to be displayed in the combo box "View All". So I will add a new record in that table that will have the value of "View All" then the filter will not work. how can i solve it ? The data type in this combo box is "text". and I have similar case for "Date" Data type in text box. Thanks -- M.A.Halim mmhalim@hotmail.com Dear "M.A....

slower BitBlt from unmanaged mem into C# hDC than old VB6
BitBlt'ing from unmanaged memory into an hDC obtained in a managed (C#) program takes 50-100% longer than the same BitBlt into an hDC obtained in an unmanaged (old VB6) program. My ShowPic() function resides in a DLL written in straight C. It reads a JPEG into memory allocated within the unmanaged DLL and then StretchDIBits()s it to the hDC passed. Some ancient VB6 code called it in a Paint event: Private Sub Picture1_Paint() ShowPic(Picture1.hdc, ...) End Sub Here is the C# code that is almost 100% slower: private void picObj1_Paint(object sender, System.Windows....

IXMLDOMDocumentPtr instance destruction
I have created an instance of IXMLDOMDocumentPtr //Create DOM Instance HRESULT hResult = m_plDomDocument.CreateInstance(MSXML2::CLSID_DOMDocument); if (FAILED(hResult)||(NULL == m_plDomDocument)) { bRet = FALSE; LEAVE_BLOCK } After this line gets executed the Handle count ( In Task Manager) gets incremented by 18 ( from 237 to 255). The handle count never gets decremented even after I come out of the dll. How can I release or destroy the DOM instances in the destructor. Is there any alternate way to bring the handle count back to where its started. I would greatly ...

event id 1171 e001000002 parameters 9 and 2 internal id 30c0465
6 Exchange servers- one in each of 6 sites- no other Exchange servers at sites. Exchange has SP4, NT 6a- all current patches on. I had to rebuild a box over the weekend. We restored everything, including Exchange. All came up fine but the server refuses to accept any DS changes at the rebuilt site and every 15 minutes I get the following message: Event Type: Error Event Source: MSExchangeDS Event Category: Internal Processing Event ID: 1171 Date: 3/6/2001 Time: 9:01:49 AM User: N/A Computer: MINER-OA Description: Exception e0010002 has occurred with parameters 9 and 2 (internal ID 30c04...

Video Capture in C++
To date I have been using the Microsoft VisSDK to access cameras / tvcards. However this is a bit outdated now and needs modernising, especially as I now need to support e.g. digital video. I assume I need to look at DirectShow ?? Anyone point me at any sample code ? MSDN is of no help as the page about this (http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnwmt/html/cplusvbappdevs.asp) is full of broken links :-( I don't know if this could be of any help, but here is Direct Show: Samples are in the archive. http://msdn.microsoft.com/library/default.asp?url=/dow...

visual studio c++ .net 2005 and mfc?
I've been using VC++ 6.0 and MFC for a few years now and I'm planning to get VC++ .NET 2005 when it comes out. I've heard MFC will be included in VC++ 2005, but I haven't been able to find anything about it on Microsoft's site. Which versions will it be included in? I know it's not in the Express version. If MFC will be included, where can I find what changes there will be? Will MFC continue to be supported in the future? If anyone's got a direct link to any MFC and VC++ .NET 2005 information please post it. And I'm so confused to which product line has ...

Visual C++ 2005 beta is a DUD
After spending the time to download the blasted thing, I found out that it does not create MFC projects. Is Uncle Bill going to drop MFC? Or this is just something which the knuckleheads from Microsoft decided to test? Are these people of this planet? If they claim that this is the feedback that they have from the users, then publish their names and fields of endeavour together with the respective company names. Are there any tools that will port MFC based applications to Borland C++, because it has became very attractive? RPG wrote: >After spending the time to download the blast...

"C:\document.xls could not be found"?
After doing a HD data transfer, all my spreadsheets open with this message, followed by a series of .xls file Excel couldn't find (apparently). File reads OK, and I can save changes, but clicking through this series of warnings on every spreadsheet is getting boring. This PC was a gift, so I don't have the MS Office disk. How to fix? Sometimes one of these works when you're having trouble with double clicking on the file in windows explorer: Tools|Options|General|Ignore other applications (uncheck it) --- or --- Close Excel and Windows Start Button|Run excel /unregserver the...

Importing null data into Excel
We have a DAT file that contains an empty column. Version 97 imported it fine, but 2003 removes the column throwing off my reports. Any ideas on how or why it's doing this? Thanks ...

Capturing Query Parameters
I've got a report I've built for a customer that runs a query that has 2 parameters which requires the user to input a start date and an end date. The query runs correctly based on the user's date selections. How do I capture the dates selected as parameters and include them in the overall report? This way the user knows which dates they selected for the results they see. I'd like them displayed in the report header for example. Thanks in advance for any suggestions. Steve The parameter names are available in the report. For example, if you called the first paramet...

SqlMembeshipProvider.Initialize name parameter
I'm not understanding what the name parameter is for in the Initialize method of the SqlMembershipProvider. It's supposed to be the name of the provider instance to initialize. But this is an instance method of the provider, so it should already know what provider it's initializing without being told. Confusion here. "Harlan Messinger" <h.usenetremoverthis@gavelcade.com> wrote in message news:80o523Fe02U1@mid.individual.net... > I'm not understanding what the name parameter is for in the Initialize > method of the SqlMembershipProvider. It...

Lookup equals null
Hi I need help with a simple bit of Jscript. I need to hide a tab when a person opens the service actvity form and the 'Service' lookup does not contain data. I used the Onload event and the following bit of script: { if (crmForm.all.serviceid.DataValue[0].name == null) crmForm.all.tab1Tab.style.display = 'none'; } crmForm.all.serviceid.FireOnChange(); This does not seem to work properly. I think there is a problem with the ==null part of the script. The OnChange event works fine and is: if (crmForm.all.serviceid.DataValue[0].name== 'Support') crmForm.all.tab1Ta...

SmartList Export to Excel Opens Another Instance of Excel
Client just moved from SP1 to SP2 on v9 Dynamics GP. Also using Excel 2003. Complaint is that while on SP1, they could export from SmartList to Excel; with Excel adding workbooks to the current Excel instance. Through the toolbar window, they could easily flip through workbooks (they have several various exports throughout their daily routine). However, now with SP2, each export will open a new instance of Excel. This results in several Excel programs open at the bottom of the screen, with each containing only one workbook. Although this may seem trivial, it does make it inco...

Saving Excel workbook in SQL server using c#
Could anyone please help me out as to how we can save the excel workbook in the database and read it back. I was able to convert the text files and image files into binary format and save them to the DB and finally able to retrive them back in the same format. But was unable to do same for the excel object. Your help will be greatly appreciated. Thanks, regards, jitender ...

How to get Filter parameter values in QRP ??
Hi all,, I would like to run a PreQuery1 from Report QRP file, with a parameter which is entered by the user in Report filter option. How i can capture that entered value in qrp, so that i can use it in PreQuery1..? Any idea? CP.Dinesh C.P., Put your statement in the report in the Prequery1 section as a View for examples, look at the Item Movement or Item Movement History, and a couple of Sales reports too. -- = Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are ...

I am receiving a message about parameter values and it won't send
I put outlook on my computer, tried to send an email, and it won't send it because of parameter values. Did I install outlook wrong or what. ...