3
I am developing an application in C# WPF, and I have two Forms.
A Form has several Abels (with the name of several fields, such as gender age, name, etc...) and under each of the Abels has a Textbox to insert a value for the same.
In the following form I have again a set of Labels with the name of the fields, and below each label I want to have another label with the value that was entered in the respective textbox in the previous form, that is to say this has to be achieved dynamically.
Does anyone have any idea how I can do this?
I have as auxiliary classes for the fields:
class:attributes
public class atributos
{
public string Name { get; set; }
public int atributoID { get; set; }
}
class: values
public class AtributosValores
{
public string Name { get; set; }
public string Value { get; set; }
}
Basically I want to present in the second set of Labels of the 2nd Form this Value, ie the Value entered in the Text Box
I create the textbox and labels dynamically too:
public static Label createNewLabelSize (string name, int content, HorizontalAlignment horizontal, VerticalAlignment vertical, int width, int height)
{
//Create a new label
Label newLabel = new Label();
//Defines the new label characteristics
newLabel.Name = name;
newLabel.Content = content;
newLabel.HorizontalAlignment = horizontal;
newLabel.VerticalAlignment = vertical;
newLabel.Width = width;
newLabel.Height = height;
return newLabel;
}
So things like label1.text = textbox2.text... don’t work!
I think you edited while you were still responding
– Rovann Linhalis
I edited the answer to suit your edition.
– Rovann Linhalis
is a public List<Attributesvalues> Values2 = new List<Attributesvalues>(); but within Form2
– Rovann Linhalis
in the Load Form 2 event, you scroll through this list to create the fields
– Rovann Linhalis
Ctrl. Controls with S at the end
– Rovann Linhalis
ok, I’m talking about Forms and vc of Window (WPF), a moment
– Rovann Linhalis
put the code to WPF
– Rovann Linhalis
any more code ?
– Rovann Linhalis
I don’t know if there’s direct chat here, but call on Facebook
– Rovann Linhalis