Click here to Skip to main content
11,921,353 members (64,952 online)
Rate this:
Please Sign up or sign in to vote.
See more: Application
I'm developing window application 2010...

My question is simple, i'm getting form name from database...

now i want to open the form using name/string coming from database...
how to convert string to form object in c# window application

please reply me.........
Posted 11-Jun-12 23:33pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you mean that you are storing the name of thr form class in the database, as in:
MyForm form = new MyForm();
And you store the string "MyForm" in your db, you can do it with reflection:
Type t = Type.GetType("MyNamespace." + "frmMyFormClass");
Form c = Activator.CreateInstance(t) as Form;
Member 3962514 12-Jun-12 5:05am
Thanks for your help this code working...,
OriginalGriff 12-Jun-12 5:14am
You're welcome!
OriginalGriff 14-Aug-12 11:56am
Ask this as a separate question - it doesn't have much relevance to the original question, and we would need more info about exactly what you are doing.
It is considered "hijacking" to ask a question on someone else's thread, and rude! :laugh:
OriginalGriff 14-Aug-12 14:00pm
This question answers part of your problem, but what remains is not related to the original query - hence it should be a new question.
No need to apologise, you aren't in trouble! :laugh:
how to access methods of mdi forms while convert string to form object in c# window application
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use
1-string name = Convert.ToString(objName);
2-string name = objName.Tostring();
3-string defaultName;
string.TryParse(objName,out defaultName);

I think these way u can convert a object to string.
Member 3962514 13-Jun-12 5:47am
i need to open submenu inside the Menu.
can you help me on this...,

before click About Us
About Us | Help

after click About button i need to'
display the chile form it contain inside the MDI form..,
|About Us | Help |
| |
| frnabout |
| |

i need to display the child form inside the parent form(menu form)
because of menu bar should be showind all the forms..,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 553
1 Dave Kreskowiak 245
2 phil.o 160
3 KrunalRohit 134
4 Sergey Alexandrovich Kryukov 132
0 OriginalGriff 6,951
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,171
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web02 | 2.8.151120.1 | Last Updated 30 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100