populate data to generic list from classes using c#
-
Hai i working on some project were i have four different classes when i enter the text in textbox based on that it is read to the that class and it is to be added to generic list how can i work on this can any help me in this
-
Hai i working on some project were i have four different classes when i enter the text in textbox based on that it is read to the that class and it is to be added to generic list how can i work on this can any help me in this
Your question isn't very clear. Do you mean something like this? using System; using System.Collections.Generic; using System.Windows.Forms; namespace MyApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MyTextClass TestClass = new MyTextClass(textBox1.Text); MyTextCollection TestCollection = new MyTextCollection(); TestCollection.Add(TestClass); //Do other stuff here... } } class MyTextClass { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } public MyTextClass() { } public MyTextClass(string Text) { _Text = Text; } } class MyTextCollection : List { } }
modified on Thursday, January 17, 2008 9:14:52 AM
-
Your question isn't very clear. Do you mean something like this? using System; using System.Collections.Generic; using System.Windows.Forms; namespace MyApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MyTextClass TestClass = new MyTextClass(textBox1.Text); MyTextCollection TestCollection = new MyTextCollection(); TestCollection.Add(TestClass); //Do other stuff here... } } class MyTextClass { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } public MyTextClass() { } public MyTextClass(string Text) { _Text = Text; } } class MyTextCollection : List { } }
modified on Thursday, January 17, 2008 9:14:52 AM
yes my problem is similar to the above one were i have four different classes and in the window from were i have text boxes if I enter the data based on that data type i need to add the remaining items to that class and to generic list but in main problem is they r nor high lighting when i write the program under the window from can u pls help me
RamyaNaidu