473,385 Members | 1,730 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,385 software developers and data experts.

Windows forms in c#

Hai,

I have one string array which contains all the names of the forms in my MDI, I need to create an instance using that name, How can i convert the string(Form Name) into form. Help me.

Cheers,
Venkat
Aug 18 '08 #1
4 970
cloud255
427 Expert 256MB
I'm not sure what you're asking.

But a string cannot become a form.

If you want to use the string as the name of the form its not too complicated.

You need to create the form at runtime and then assign an value to the name property. You do this in a loop using each of the strings in your array as the form name.

but i'm not sure what you are trying to do, could you clarify your quesstion a bit more please.
Aug 18 '08 #2
Hai Thank u for ur reply,

Actually i am trying to do preference settings for my project. For that i have used one ini file which stores the loaded forms(Section) and thier bounds and back color(keys). When i opened a application next time the the bounds of the forms will
be as like as when it was closed. So i load the form using that ini file (which has form name) and thier properties. Are u clear now....

Cheers,
Venkat
Aug 18 '08 #3
cloud255
427 Expert 256MB
Ok,

so you still have to create the froms at runtime. Then assing the right value to each property from your INI file. So make a loop which loops through all the data in the INI (you must have it seperated in some way like one per line or some sort of identifier in the file) and then create a new from and assign the properties to the form.

to give a value for the name of a form you just address the "Name" property.

When you want to write to your INI file after running the application you can loop through all the children in the MDI parent and adress them by name:

Expand|Select|Wrap|Line Numbers
  1. foreach (Form frm in this.MdiChildren)
  2.             {
  3.                 MessageBox.Show(frm.Name);
  4.             }
Hope this helps.
Aug 18 '08 #4
Ok,

so you still have to create the froms at runtime. Then assing the right value to each property from your INI file. So make a loop which loops through all the data in the INI (you must have it seperated in some way like one per line or some sort of identifier in the file) and then create a new from and assign the properties to the form.

to give a value for the name of a form you just address the "Name" property.

When you want to write to your INI file after running the application you can loop through all the children in the MDI parent and adress them by name:

Expand|Select|Wrap|Line Numbers
  1. foreach (Form frm in this.MdiChildren)
  2.             {
  3.                 MessageBox.Show(frm.Name);
  4.             }
Hope this helps.

Hi,

Thanks for your Reply..
Aug 18 '08 #5

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

Similar topics

2
by: Greg Bacchus | last post by:
Hi, I'm getting an exception that really has me stumped. It's sporadic at best, it's only happened a handful of times. This particular time it happened when the user pressed 'Alt-S' to save the...
15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
5
by: david | last post by:
I have developed my web service with a domain name of my computer name and wwwroot directory. I also developed a client of windows form application. It works locally (i.e. in the same machine). ...
7
by: Tyler Foreman | last post by:
Hello, I have a strange problem that occurs every so often in my application. It usually takes place when I hide one form and activate another. What happens is I get the following exception:...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
1
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.