Re: Error is Object doesn't support this property or method



I did try it without the "ref" and it would not compile. It requires the "ref".

Thanks.
--
John Olbert



"Willy Denoyette [MVP]" wrote:



"John Olbert" <someone@xxxxxxxx> wrote in message
news:E7F8388C-F832-4E6B-A3FA-FA62DE1C4955@xxxxxxxxxxxxxxxx
| Subject: Error is Object doesn't support this property or method
|
| I am trying to pass a C# string under Vs2005 (Net2) to an Vb6 ActiveX
| Control.
|
| I get the following runtime error--
| "Object doesn't support this property or method"
|
| Yet the Intellisense shows the following--
| axMainViewJ1Obj1.AddFileJ1(ref string str);
|
| Also the project compiles without error.
|
| The Vb6 method is--
| Public Function AddFileJ1(FileName As String) As Boolean
|
| Calling it from a test Vb6 Exe program works fine.
|
| The actual code snippet in C# is--
| string str=@"G:\Program FilesJ1\Iris\Data\Data\Example 1 - identified and
| well separated.rst";
| axMainViewJ1Obj1.AddFileJ1(ref str);
|
| Any suggestions would be appreciated.
|
| --John Olbert
| javo2000@xxxxxxxx
|
|
| The full error information at runtime is--
| System.NotSupportedException was unhandled
| Message="Object doesn't support this property or method"
| Source="MainViewJ1"
| StackTrace:
| at MainViewJ1._MainViewJ1Obj.AddFileJ1(String& FileName)
| at AxMainViewJ1.AxMainViewJ1Obj.AddFileJ1(String& fileName)
| at Ce1.Form1.test1aToolStripMenuItem_Click(Object sender, EventArgs
| e) in G:\Vx8\Vcs8J1\Interop\MainView\Ce1\Form1.cs:line 41
| at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key,
| EventArgs e)
| at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
| at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
| at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs
e)
| at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs
| e, ToolStripItemEventType met)
| at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e,
| ToolStripItemEventType met)
| at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
| at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs
mea)
| at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
| button, Int32 clicks)
| at System.Windows.Forms.Control.WndProc(Message& m)
| at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
| at System.Windows.Forms.ToolStrip.WndProc(Message& m)
| at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
| at
| System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
| at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
| at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
| Int32 msg, IntPtr wparam, IntPtr lparam)
| at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
| at
|
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
| dwComponentID, Int32 reason, Int32 pvLoopData)
| at
| System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
| reason, ApplicationContext context)
| at
| System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason,
| ApplicationContext context)
| at System.Windows.Forms.Application.Run(Form mainForm)
| at Ce1.Program.Main() in
| G:\Vx8\Vcs8J1\Interop\MainView\Ce1\Program.cs:line 17
| at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
| at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
| assemblySecurity, String[] args)
| at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
| at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
| at System.Threading.ExecutionContext.Run(ExecutionContext
| executionContext, ContextCallback callback, Object state)
| at System.Threading.ThreadHelper.ThreadStart()
|
|
|

axMainViewJ1Obj1.AddFileJ1(str);


Willy.



.