I've downloaded this code that's in VB.NET - it allows any object to be placed in a status bar panel - button, progress bar etc. I *think* I've converted it to C# ok (it compiles anyway). But now, trying to call a method, I'm running into something I don't know how to fix.
Here's the code I'm calling:
Calling with:Code:public StatusBarChild(ref object obj, ref StatusBar sb, ref Int16 intPanelNumber, Int32 intMargin) { ChildObject = (Control)obj; StatusBar = sb; Panel = intPanelNumber; Margin = intMargin; ChildObject.Parent = StatusBar; Resize(); ChildObject.Visible = true; }
The compiler is complaining about the three args that get passed by ref, for example, "cannot convert from 'System.Windows.Forms.StatusBar to 'ref object''" for the first arg.Code:sbcProgressBar = new fr.free.marcon.e.StatusBarChild(progressBar1, statusBar1, 1, 2);
I tried just adding a ref in front of progressBar1, but then another error - "cannot convert from ref ...StatusBar to ref object".
Can anyone help me out? I might have converted the VB code incorrectly, but not really sure.
TIA,
Mike




Reply With Quote