Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
In WPF,

I want to do a simple command.
Run a tableadapter query to return some results,
I want each of those results to be inserted into a Collection.
I know the code is wrong but I want to show the goal I want to accomplish.
Look at DATASET?

You can probably tell I moved over from windows forms and am not experienced with xaml. Any code will help.

Thank you,
C#
public class FieldCollection : ObservableCollection<FieldName>
    {
        public FieldCollection(int test)
            : base()
        {
            DataTableAdapters.DataTableAdapter NewAdapter = new DataTableAdapters.DataTableAdapter();

            DATASET? = DataTableAdapter.GetData(test);
            foreach (datarow row in DATASET?)
            {
                Add(new FieldName("test"));
            }
        }
    }

    public class FieldName
    {
        private string fieldvalue;

        public FieldName(string field)
        {
            this.fieldvalue = field;
        }

        public string FieldValue
        {
            get { return fieldvalue; }
            set { fieldvalue = value; }
        }

    }

Edit: added code block.
Posted
Updated 16-Apr-13 6:33am
v2
Comments
Kenneth Haugland 16-Apr-13 12:32pm    
Dont understand you code but normally you can just type something like:
DataGridView1.ItemsSource = DataSet.Table[0].DefaultView
Clifford Nelson 16-Apr-13 19:00pm    
Would help to see your XAML and your ViewModel.

1 solution

 
Share this answer
 

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