On Wed, 04 Feb 2015, bill-lancaster wrote: > I have a form with:- > > Public Sub _new(Optional iNr As Integer) > iStatementNr = iNr > End > > When the form is opened with:- > > Dim hForm As FFormName > hForm = New FFormName1019)
Assuming this should read: hForm = New FFormName(1019) > hForm.ShowModal > > I get this error message - "Type mismatch: wanted control, got integer > instead" > Form inherits Window and Window has an optional constructor argument (like every widget): a parent control in which the widget should be created. As said in the object model document[0], you need to pass the arguments for all parent classes when you create an object -- and the arguments from the parent class are always in front of the ones of the child class. That is, the actual constructor of your FFormName has a signature like FFormName._new(Optional Parent As Control, Optional iNr As Integer) If you want your FFormName object to be an actual window, you can pass a Null as the Parent argument. > Wheras just:- > FFormName.ShowModal() > Works OK > This is totally different. You are using the automatic instance[1] of your FFormName class here which is an object that was already created. Regards, Tobi [0] http://gambaswiki.org/wiki/doc/object-model#t18 [1] http://gambaswiki.org/wiki/lang/createstatic -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user