keitsi Posted April 4, 2004 Posted April 4, 2004 I searched all over the forums and still didn't find a neat way to do this :) Shortly: Is it possible to loop through all design time created (form) classes? I do not mean form objects but the classes. I do not need to detect if the form class has a visible object or anything, just wanna create a new instance of every form class I created design time. i.e. something like this (of course this does not work :eek: ) Dim frm As Form For Each SomeType In MyProject.Typecollection If SomeType Is form then frm = New SomeType DumpFormContentsToFile(frm, "c:\" & frm.name & "_dump.txt") frm.close endif Next msgbox "Contents of all forms were dumped to C:\" The reason for this is that I want to be able to dynamically 'dump' all the Texts inside form to a custom formatted text file, for multilingual translator class. I think i found a neat way to make my app multilingual, without messing up the desing time view or making any changes during design time. =) Thanks mates. For sure I will post the class here if I get it done someday. edit: vbulleting messing up my smilies Quote BS - Beer Specialist
AlexCode Posted April 4, 2004 Posted April 4, 2004 One way I'm seeng to solve that is to create an ArrayList and fill it with the DesignTime objects (witch you call classes)... When you need, just loop thru the items of the ArrayList and "Dump" them as you like... Just a short node... in OOP languages, Objects aren't just the UI component we use on the forms... objects are all the classes we have, so this soesn't make any sence: I do not mean form objects but the classes Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Leaders dynamic_sysop Posted April 4, 2004 Leaders Posted April 4, 2004 if you want to search for all Forms in your app ( open or not ) ... [color=Blue]Dim[/color] frmType [color=Blue]As[/color] Type [color=Blue]For Each[/color] frmType [color=Blue]In [/color] Reflection.Assembly.GetExecutingAssembly.GetTypes [color=Blue]If[/color] frmType.IsSubclassOf([color=Blue]GetType[/color](Form)) [color=Blue]Then[/color] [color=Blue]Dim[/color] f [color=Blue]As[/color] Form = frmType.InvokeMember([color=Blue]Nothing[/color], Reflection.BindingFlags.CreateInstance, [color=Blue]Nothing[/color], [color=Blue]New[/color] Form, [color=Blue]Nothing[/color]) [color=Green] '/// do stuff for each form it finds.[/color] [color=Blue]End If[/color] [color=Blue]Next[/color] Quote
keitsi Posted April 4, 2004 Author Posted April 4, 2004 if you want to search for all Forms in your app ( open or not ) ... Wow, thanks! I never would have found that out by myself :P Quote BS - Beer Specialist
AlexCode Posted April 4, 2004 Posted April 4, 2004 Hey dynamic_sysop... with 2 kids how do you manage to find such fancy code? :D Good job! Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Leaders dynamic_sysop Posted April 4, 2004 Leaders Posted April 4, 2004 i have 5 kids mate :D ( and 3 cats :eek: ) i have posted that code many times now in different formats , it's good for finding forms , then checking if they are open / closing with a SendMessage( handle , WM_CLOSE , 0 , 0 ) ;) Quote
AlexCode Posted April 4, 2004 Posted April 4, 2004 Hey... this thread is becomming some kind of familly discussion but... 5 kids and still time to devellop something???? The days in your cuntry must have more hours than here in Portugal! :) Whish you all that's good... Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Leaders dynamic_sysop Posted April 4, 2004 Leaders Posted April 4, 2004 one last note on it ( cuz i don't wanna take over the thread ;) ) ... lol , the best thing is , we are also in the process of moving house ( on tuesday we are moving house to a new location a couple of hours away from where we are now ) so , i'm coding , running a house with my wife / 5 kids / 3 cats and moving also :eek: hard work , but fun. Quote
AlexCode Posted April 4, 2004 Posted April 4, 2004 I wish you plentty of time & luck & money for the upcomming times mate... :p Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.