I'm having a problem when I want to make a table using a DataTable
and a DataGrid
, simply by saying the Rows' lines it appears a following error:
DataGrid does not contain a definition for' Rows' and could not find any 'Rows' extension method that accepts a first argument of type' DataGrid '(is there a usage directive or missing assembly reference?)
I really do not know what to do, read the code I used below, the part of the error I left in bold.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btn_salvar_Click(object sender, RoutedEventArgs e)
{
DataTable Tabela = new DataTable();
Tabela.Columns.Add("Name");
Tabela.Columns.Add("Region:");
DataRow row = Tabela.NewRow();
row["Name"] = "";
row["Region"] = "";
Tabela.Rows.Add(row);
foreach (DataRow drow in Tabela.Rows) ;
{
int Livros = Tabela_.**ROWS**.Add();
Tabela_Livro.**ROWS**[num].Cells[0]Value = drow["Name"].ToString();
Tabela_Livro.**ROWS**[num].Cells[1]Value = drow["Region"].ToString();
}
}
}