VB6 accessing VB.NET SF User Control and/or SF Form


Author
Message
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I need to develop a new SF WinForm or User Control that can be accessed from our VB6 application. What is the best way to do this and how would you call it or access it from vb6.

Here is what I have done so far...

I created a SF Business Object Library Project and made it COM Visible. I then added a SF User Control and placed a few controls on it for testing. I created one public property on the user control.

I then created a VB6 app and using the VBControlExtender, I was able to Add the user control to my form and make it visible, although only a few controls appeared. (Haven't figured out why yet).  I can't seem to set the public property on my user control. I get a out of memory error.

Anyway, just wanted to know if there is a better way to launch a form and pass some values to the user control or form. I will be doing this quite a bit as we migtrate all our apps to vb.net.

Thanks,
Tim

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, making it COM visible is probably the best way to go.  It would probably be easier to call your VB6 methods from within .NET than to call your .NET COM from within VB6; however, that would be a huge re-design of your current system, so you can probably throw that one out. 

As for a user control, I've never tried to show a user control within another application.  I know that platform interop when IntPtr handles are shared within a form can be tricky.  So, if you can show a whole .NET form rather than just a .NET user control, you'd probably be better off.  Why only a few of the buttons became visible I do not know.  The only pointers I can provide would be to create a .NET method that you can call from VB6 that will initialize the .NET app domain.  We call ours SetEnvironment(), and it does thinks like EnableVisibualStyles = True, DataBasics.DataSources.Add(), etc.  Anything that you would normally do from within your AppMain.vb, you will need to do in this method to initialize all of the .NET stuff.

Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I wrote COM wrapper for one of my UI forms that I need to call from VB6. Evertything works perfectly, after dealing with the connections and localization files etc..., except I'm getting an error on my combox requery's.  I am populating the combo boxes on the form using the SF Item population settings. 

I created a quick .NET calling program that refereces my COM dll and it seems to work fine from here.

Any idea's what is causing this and what I need to correct this.

Thanks

TIm

************** Exception Text **************

System.Exception: Type 'Avanti.BusinessObjects.sch_WorkFamilyBO' could not be found in the referenced assemblies. ---> System.Exception: The call to 'MicroFour.StrataFrame.Tools.GetTypeFromReferencedAssemblies' failed because the entry assembly could not be evaluated.

   at MicroFour.StrataFrame.Tools.Common.GetTypeFromReferencedAssemblies(String TypeName)

   --- End of inner exception stack trace ---

   at MicroFour.StrataFrame.Tools.Common.GetTypeFromReferencedAssemblies(String TypeName)

   at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateComboFromBusinessObject(IListControl lstControl, Object[] Parameters)

   at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateCombo(Control lstControl, Object[] Parameters)

   at MicroFour.StrataFrame.UI.Windows.Forms.Infragistics.UltraComboEditor.PopulateCombo(Object[] Parameters)

   at MicroFour.StrataFrame.UI.Windows.Forms.Infragistics.UltraComboEditor.Requery()

   at MicroFour.StrataFrame.UI.Windows.Forms.Infragistics.UltraComboEditor.InitializeObject()

   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()

   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)

   at System.Windows.Forms.Form.OnCreateControl()

   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

   at System.Windows.Forms.Control.CreateControl()

   at System.Windows.Forms.Control.WmShowWindow(Message& m)

   at System.Windows.Forms.Control.WndProc(Message& m)

   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

   at System.Windows.Forms.ContainerControl.WndProc(Message& m)

   at System.Windows.Forms.Form.WmShowWindow(Message& m)

   at System.Windows.Forms.Form.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search