Click here to Skip to main content
15,900,482 members
Home / Discussions / C#
   

C#

 
GeneralRe: manipulate IE favourites Pin
benjymous7-Oct-04 22:10
benjymous7-Oct-04 22:10 
GeneralRe: manipulate IE favourites Pin
Heath Stewart7-Oct-04 22:13
protectorHeath Stewart7-Oct-04 22:13 
GeneralRe: manipulate IE favourites Pin
benjymous7-Oct-04 22:26
benjymous7-Oct-04 22:26 
GeneralRe: manipulate IE favourites Pin
Heath Stewart7-Oct-04 22:30
protectorHeath Stewart7-Oct-04 22:30 
GeneralRe: manipulate IE favourites Pin
benjymous8-Oct-04 2:11
benjymous8-Oct-04 2:11 
GeneralRe: manipulate IE favourites Pin
Heath Stewart8-Oct-04 9:56
protectorHeath Stewart8-Oct-04 9:56 
GeneralRe: manipulate IE favourites Pin
Heath Stewart7-Oct-04 22:12
protectorHeath Stewart7-Oct-04 22:12 
GeneralC# behaves differently then VB.net for InterOP generic Objects Pin
SPA1247-Oct-04 15:23
SPA1247-Oct-04 15:23 
I am trying to understand the following probem I am having with C# code trying to access a COM object which is generic.
Actually it can be recreated as follows:

Create a VB6 COM dll with a method as follows:
Public Function TestCSharp(ByVal sObjectName As String) As Object

If sObjectName <> "" Then

Set TestCSharp = CreateObject(sObjectName)

End If

End Function

Now write a C# class to access it and write the following code
CSharpTest.InterOpObjClass oObject = new CSharpTest.InterOpObjClass();
ADODB.Recordset oRS;
oRS = (ADODB.RecordsetClass) oObject.TestCSharp("ADODB.Recordset");

It gives an error saying specified cast is not valid, basically an invalid cast exception

Now try the same in VB.net
Dim oObject As CSharpTest.InterOpObjClass = New CSharpTest.InterOpObjClass
Dim oRS As ADODB.Recordset
oRS = oObject.TestCSharp("ADODB.Recordset")

This works fine.

Why is C# unable to unbox the value? I have noticed this for all interop objects that return type Object.
C# seems to treat them as System.__ComObject and I guess it does not like a conversion between System.__ComObject and ADODB.RecordSet or infact any other.

Is there a way around this in C#?
GeneralRe: C# behaves differently then VB.net for InterOP generic Objects Pin
sreejith ss nair7-Oct-04 20:54
sreejith ss nair7-Oct-04 20:54 
GeneralC# questions Pin
serjiro7-Oct-04 14:31
serjiro7-Oct-04 14:31 
GeneralRe: C# questions Pin
Christian Graus7-Oct-04 15:07
protectorChristian Graus7-Oct-04 15:07 
GeneralRe: C# questions Pin
Alex Korchemniy7-Oct-04 17:11
Alex Korchemniy7-Oct-04 17:11 
GeneralTimeline : how to create in C# Pin
youssef7-Oct-04 13:16
youssef7-Oct-04 13:16 
GeneralRe: Timeline : how to create in C# Pin
Colin Angus Mackay7-Oct-04 13:36
Colin Angus Mackay7-Oct-04 13:36 
GeneralRe: Timeline : how to create in C# Pin
Alex Korchemniy7-Oct-04 13:49
Alex Korchemniy7-Oct-04 13:49 
GeneralRe: Timeline : how to create in C# Pin
Colin Angus Mackay7-Oct-04 13:58
Colin Angus Mackay7-Oct-04 13:58 
GeneralRe: Timeline : how to create in C# Pin
Charlie Williams7-Oct-04 14:10
Charlie Williams7-Oct-04 14:10 
GeneralRe: Timeline : how to create in C# Pin
Colin Angus Mackay7-Oct-04 14:16
Colin Angus Mackay7-Oct-04 14:16 
GeneralRe: Timeline : how to create in C# Pin
Anonymous7-Oct-04 14:26
Anonymous7-Oct-04 14:26 
GeneralRe: Timeline : how to create in C# Pin
Heath Stewart7-Oct-04 22:08
protectorHeath Stewart7-Oct-04 22:08 
GeneralRe: Timeline : how to create in C# Pin
ValentinR7-Oct-04 21:19
ValentinR7-Oct-04 21:19 
GeneralFiltering the Intellisense Dropdown Pin
Matt Gerrans7-Oct-04 12:56
Matt Gerrans7-Oct-04 12:56 
GeneralRe: Filtering the Intellisense Dropdown Pin
Alex Korchemniy7-Oct-04 14:10
Alex Korchemniy7-Oct-04 14:10 
Generalmissing interfaces from tlb Pin
Member 12529757-Oct-04 12:26
Member 12529757-Oct-04 12:26 
Generalwrapping text in listview (detail view) Pin
vista277-Oct-04 11:59
vista277-Oct-04 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.