Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a form with a textbox and the text box gets dynamicaly loaded on the form load. i need to assign multiple values to the textbox without replacing the previous values when ever the form is loaded. for example: i have 2 items when i click on the first item the form gets loaded and i enter 45 in the textbox and then i click the second item the form again gets loaded and i enter 54 in the textbox and now when i go to the first item and load the textbox i want the value to be 45 and shouldn't be replaced with 54.. how do i do this??
i have an expander and several icons in it when i drag and drop an item from it to a canvas a pop up window comes asking me to assign a value for the item. on right clicking the item on the canvas another window comes up showing the value that has been entered in the previous pop up form. and if i drag an drop the same kind of icon again from the expander the same procedure happens but the value of the first icon gets replaced by the newly entered value


EDIT: From Comments:

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace MotionControl.PropertiesForms
{
public partial class property : Form
{
instance inst;
Micropositionclass micro;

public property()
{
InitializeComponent();
micro = Micropositionclass.Instance;

inst = instance.Instance;
if(inst.firstGuidList.Contains(inst.a))
{
this.Text = "MPC1";

}

else if (inst.secondGuidList.Contains(inst.a))
{

this.Text = "MPC2";


}


else if (inst.thirdGuidList.Contains(inst.a))
{
this.Text = "MPC3";

}
else if (inst.fourthGuidList.Contains(inst.a))
{
this.Text = "MPC4";

//MPC.Default.Save();
}
else if (inst.fifthGuidList.Contains(inst.a))
{
this.Text = "MPC5";

//MPC.Default.Save();
}
else if (inst.sixthGuidList.Contains(inst.a))
{
this.Text = "MPC6";

//MPC.Default.Save();
}
else if (inst.seventhGuidList.Contains(inst.a))
{
this.Text ="MPC7";

//MPC.Default.Save();
}
else if (inst.eighthGuidList.Contains(inst.a))
{
this.Text = "MPC8";


//MPC.Default.Save();
}
else if (inst.ninthGuidList.Contains(inst.a))
{
this.Text = "MPC9";

//MPC.Default.Save();
}
else if (inst.tenthGuidList.Contains(inst.a))
{
this.Text = "MPC10";

//MPC.Default.Save();
}
switch (inst.tooltip)
{
case "Move":
this.Size= new Size(238,226);
Label lbl1 = new Label();
lbl1.Text = "X";
lbl1.Location = new Point(15, 35);
lbl1.Size = new Size(14, 13);
Controls.Add(lbl1);
Label lbl2 = new Label();
lbl2.Text = "Y";
lbl2.Location = new Point(15, 70);
lbl2.Size = new Size(14, 13);
Controls.Add(lbl2);
Label lbl3 = new Label();
lbl3.Text = "Z";
lbl3.Location = new Point(15, 105);
lbl3.Size = new Size(14, 13);
Controls.Add(lbl3);
TextBox tb1 = new TextBox();
tb1.Text = micro.movex.ToString();

tb1.Location = new Point(105, 35);
tb1.Size = new Size(100, 20);
Controls.Add(tb1);
TextBox tb2 = new TextBox();
tb2.Text = micro.movey.ToString();
tb2.Location = new Point(105, 70);
tb2.Size = new Size(100, 20);
Controls.Add(tb2);
TextBox tb3 = new TextBox();
tb3.Text = micro.movez.ToString();
tb3.Location = new Point(105, 105);
tb3.Size = new Size(100, 20);
Controls.Add(tb3);
break;
case "Speed":
this.Size = new Size(220, 162);
Label speed = new Label();
speed.Text = "Speed";
speed.Location = new Point(20, 40);
Posted
Updated 2-Jun-15 23:15pm
v3
Comments
OriginalGriff 3-Jun-15 5:01am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
I think you need to give us rather more detail of exactly what you are trying to achieve - the existing description doesn't really make a lot of sense without the project context you are familiar with, and we aren't!
Use the "Improve question" widget to edit your question and provide better information.
Varun Sareen 3-Jun-15 5:47am    
what you want to show then in the text box if not replacing the old value.?
Rashmi Sutar 3-Jun-15 9:07am    
hi,

but why page is loading after entering first text box value.
Does it have any specific reason.

1 solution

You have to build a new Instance for the second (and each following) call.
What you are doing (my interpretion) is a kind of Messagebox or Dialog.
 
Share this answer
 
Comments
Member 11521909 3-Jun-15 6:10am    
can u give me more detail
Ralf Meier 4-Jun-15 1:41am    
Is it a kind of Dialog what you are doing there ? (Do you know what a Dialog is ?)
Or ... does both different Form-showings (with the different values on it) exist at the same time ?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900