954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to show a form using a string value

Hi im a student programmer and I was writing a program... and I need to beable to load a form from string variable like


Private Sub cmdLoad_Click()

dim strFormLink(99) as string

strFormLink(1).Show

End Sub

That will not work... Have Any ideas(If you do I'd be really greatful

I tried code like this

Dim FrmObj As Form, TempObj As Form
Dim StrVal As String
Dim Find As Boolean

Find = False
StrVal = "Form2"

For Each TempObj In Forms

If TempObj.Name = StrVal Then

Set FrmObj = TempObj
Find = True

End If

Next

If Find = True Then FrmObj.Show


But Its too much for the program to handle(Because its a game... and its already really slugish

I am implimenting this code because I have added a map editor so I do not need to open the source code and recompile when making changes to the map... All I have to do is edit the map

CzechRock3
Light Poster
37 posts since Mar 2008
Reputation Points: 10
Solved Threads: 2
 

From you code i am not at all sure what you want to do. Could you explain a bit.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

i m not sure u can do this. if you use variable to accommodate form name there are no function to call form. your variable still a string.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Yah, I did a little more research and there is not other way. Thanks for your help. I managed to solve the problem.

I was trying to make it more efficient xD

CzechRock3
Light Poster
37 posts since Mar 2008
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You