| | |
Convert string variable into form object in VB6
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 7
Reputation:
Solved Threads: 0
hello there,
anyone can help...
is this possible?
i have a string value of form names in my DB so when my condition passes, the variable string will take over the value , then that value will call the form(variable) as string.
i got an error when i use this code.
dim objForm as form
dim sValue as string
sValue="frmXXX"
set objForm=sValue
objForm.show
This is what the code looks like... i need to convert the variable string to form object
thanks a lot.
anyone can help...
is this possible?
i have a string value of form names in my DB so when my condition passes, the variable string will take over the value , then that value will call the form(variable) as string.
i got an error when i use this code.
dim objForm as form
dim sValue as string
sValue="frmXXX"
set objForm=sValue
objForm.show
This is what the code looks like... i need to convert the variable string to form object
thanks a lot.
Last edited by Neophyte08; Jan 4th, 2008 at 5:37 am.
•
•
Join Date: Jan 2008
Posts: 7
Reputation:
Solved Threads: 0
Mbt925, thank you so much for the help...
You have a good solution... i already do that kind of code, only applies to loaded/Active forms but in my case i will not load any form on it, just call them even unload/inactive...
just convert the string variable into object form name that i really needed.
thank you so much for the help...
maybe you have some ideas about this, i just want to call/show the forms in a generic way, i made a program to be a user defined function call.
is this idea possible? any help pls.
You have a good solution... i already do that kind of code, only applies to loaded/Active forms but in my case i will not load any form on it, just call them even unload/inactive...
just convert the string variable into object form name that i really needed.
thank you so much for the help...
maybe you have some ideas about this, i just want to call/show the forms in a generic way, i made a program to be a user defined function call.
is this idea possible? any help pls.
•
•
Join Date: Jan 2008
Posts: 7
Reputation:
Solved Threads: 0
yah! i know its hard to do, but i am just asking if it is possible...
i already got the answer to my question. their is another way how to show the form via variable and my problem solved already...
thanks a lot for the support... hope we could share again later some ideas in developing software.
well, if you dont mind can i have your asl pls?
thanks! God bless.
i already got the answer to my question. their is another way how to show the form via variable and my problem solved already...
thanks a lot for the support... hope we could share again later some ideas in developing software.
well, if you dont mind can i have your asl pls?
thanks! God bless.
•
•
•
•
dim objForm as form
dim sValue as string
sValue="frmXXX"
set objForm=sValue
objForm.show
This is what the code looks like... i need to convert the variable string to form object
thanks a lot.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim strFormName as String Select strFormName Case "formXXX" formXXX.show Case "FormX1" FormX1.show Case "FormX2" FormX2.show End Select
•
•
Join Date: Jan 2008
Posts: 7
Reputation:
Solved Threads: 0
yah! ok...
well, in my solution you can solved in two ways, provided the form exist in your project
if not error will take over:
sValue="frmXXX"
#1 'You can use the add command
set frmName=forms.add("sValue")
frmName.show
#2 'Using the CallByName function in VB6
set frmName=CallByName(Forms,"Add",vbMethod,sValue)
frmName.show
you can use either of this two solution i have.
This idea comes in my mind its because i managed more than a hundred forms in one project and i dont want a conditions or a hard coded, it makes your code messy.
anyone can use this code...
well, in my solution you can solved in two ways, provided the form exist in your project
if not error will take over:
sValue="frmXXX"
#1 'You can use the add command
set frmName=forms.add("sValue")
frmName.show
#2 'Using the CallByName function in VB6
set frmName=CallByName(Forms,"Add",vbMethod,sValue)
frmName.show
you can use either of this two solution i have.
This idea comes in my mind its because i managed more than a hundred forms in one project and i dont want a conditions or a hard coded, it makes your code messy.
anyone can use this code...
•
•
Join Date: Jan 2008
Posts: 7
Reputation:
Solved Threads: 0
•
•
•
•
If you already have the forms made, that really shouldn't be a problem. Use a Select CASE statement.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim strFormName as String Select strFormName Case "formXXX" formXXX.show Case "FormX1" FormX1.show Case "FormX2" FormX2.show End Select
hi hkdani,
Thank you so much for the solution I really appreciated.
Well, that was my old approach or old way of showing form,
i put it in the module all of them.
i think that could be applied to less than a hundred forms, what if you have more than a hundred you will declare all.
what i am trying here is to call the specific form from the table without any conditions and hard coded way, all are variables.
as of now i have more than 150 forms in a project.
thank you, hope we could share ideas later.
God Bless my friend.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: C To Vb 6
- Next Thread: Find Record
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





