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

Create (Design) a dialog box at run time.

Hello,

I want to design a dialog box based on parameters I read from a file.
For example in the file I find "Name/char/25" and then I create a Label Text
(Name) and an Edit control that receive the value. Then I can save the
result to an XML file or other.

Thanks in advance for your help.

Jean Lemaire
Nov 16 '05 #1
2 1868
Hi,

You can create windows controls at tun time(the type of the control you can
decide based on the data stored in your disk file) and add the same to your
windows form.

Sample code is shown below:

private System.Windows.Forms.TextBox textBox1;
this.textBox1 = new System.Windows.Forms.TextBox();

this.textBox1.Location = new System.Drawing.Point(248, 104);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = " ";

this.Controls.Add(this.textBox1); //add text box to form
NOTE: the display position of text box is controlled using Position
property. You have to setup the position according to your layout requirement.

Thanks and Regards,
GirishKumar

"Jean Lemaire" wrote:
Hello,

I want to design a dialog box based on parameters I read from a file.
For example in the file I find "Name/char/25" and then I create a Label Text
(Name) and an Edit control that receive the value. Then I can save the
result to an XML file or other.

Thanks in advance for your help.

Jean Lemaire

Nov 16 '05 #2
GirishKumar wrote:
private System.Windows.Forms.TextBox textBox1;
this.textBox1 = new System.Windows.Forms.TextBox();


Creating a single member varaible of a specific type is probably not the
best method of handing this. It would probably be better to use a generic
local variable.

System.Windows.Forms.Control control = null;
if ( /* whatever criterion to determine type wanted */)
{
control = new System.Windows.Forms.TextBox();
}
else { /* etc */ }

this.Controls.Add(control);
--
Truth,
James Curran [erstwhile-MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
by: macca | last post by:
Hi, I am writing a GUI application. It will have a number of user defined controls( I plan to use/create a user defined control that will output alarm states that the user can also select and...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
9
by: Gord | last post by:
In VB6, a custom dialog can be easily created by adding a new form, adding whatever controls you like, sizing it as you like, adding code and then just loading/unloading it whenever you like....
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
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
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...

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.