473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert String, To Object, Then To Form

devonknows
137 100+
Hi, The problem im having is, Im creating a user control. The user (via the Property Page's) will set his own menu titles, and the choose a form of which that title links to. If that makes sense.

So the form names are stored in string data, how can i convert it from a string to an object or to a form so that when someone clicks on the title the form will show. Is there a way to loop though form names?

But i dont want to have to add and if-then-else statement or select-case statement for every form i have.
Example:
Expand|Select|Wrap|Line Numbers
  1. if  txtFormName.Text = "frmMain" then
  2.     frmMain.show
  3. end if
Any help again would be appreciated
Kind Regards
Devon
Feb 1 '08 #1
7 3661
Killer42
8,435 Expert 8TB
What version of Vb is this in?
Feb 1 '08 #2
devonknows
137 100+
What version of Vb is this in?
The version im using is VB6 (Microsoft Visual Studio 6)

Kind Regards
Devon
Feb 1 '08 #3
devonknows
137 100+
The version im using is VB6 (Microsoft Visual Studio 6)

Kind Regards
Devon
Just bumping this up
any help would be appreciated

Kind Regards
Devon
Mar 9 '08 #4
Killer42
8,435 Expert 8TB
Try looping through the Forms collection until you hit the one with the required name. Or was it caption... whatever.
Mar 10 '08 #5
devonknows
137 100+
Try looping through the Forms collection until you hit the one with the required name. Or was it caption... whatever.
i tried what you asked but wen i used

dim frm as Form
for each frm in forms
if frm.name = arrFrm(Index)
next

all it does is it searches through the forms that are already open/loaded
but with the amount of forms that i have it would be inpractical and it would use laods of resources loading them all.

is there anyway to loop through the forms that arn't open/loaded?

Kind Regards
Devon
Mar 14 '08 #6
Killer42
8,435 Expert 8TB
I don't know the answer to that, but I wonder whether you could work around it by maintaining your own array or collection, updating it in the forms' load/unload event procedures. given the need to identify forms that aren't currently loaded (and presumably may never have been loaded yet) I think you'd need to load up the complete array/collection at startup. Then use the event procedures to maintain a current status of each form.

Granted it's a pretty ugly way of goling about it, but it's the best I can come up with at the moment. Does it sound doable? I don't recall enough about the prior discussion to say one way or the other.
Mar 17 '08 #7
Killer42
8,435 Expert 8TB
Oops!

Just re-read some of the earlier messages and it looks as though my suggestion will be no help whatsoever. Sorry about that.

Can't think of anything better right now.
Mar 17 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: JimMenees | last post by:
I know there's an easy answer to this which is escaping me: -------------------------------------------------------------------------- ----------------------- I have clickable thumb images which...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
3
by: ET | last post by:
I don't know whats the problem, but after I added functions to first verify, then relink linked tables if not found, now I can't convert that database to MDE format. I can split the database, but...
3
by: James | last post by:
Has anyone written a utility to convert a C# form to C++.net? i.e. to convert "using System.Data" to "using namespace System::Data" etc
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
14
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
9
by: keliie | last post by:
Hello (from Access novice), I'm building a switchboard form (using a Treeview object). The treeview is populated by two tables (tblSwitchboardParent and tblSwitchboardChild). Within...
6
by: Ken Fine | last post by:
This is a basic question. What is the difference between casting and using the Convert.ToXXX methods, from the standpoint of the compiler, in terms of performance, and in other ways? e.g. ...
2
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does 1+1 equal 11? or How do I convert a string to a number?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.