I have the following problem: I am creating buttons from the results that I find in the database. I would just like to position them secondarily, and when he reaches the end, breaks the line and continues .. I'm working on a Bar screen, where I have tables. So I would like a help there.
private void generatesBoxes ()
{
const string strCmd="SELECT codi_table_controle, iden_mesa_controle FROM titanium
. gourmet_mesa_controle
" +
"WHERE stat_table_controle is not null AND stat_table_controle = 'Open';";
var dt = new DataTable("MesasControles");
using (conexao)
{
conexao.Open();
using (var da = new MySqlDataAdapter(strCmd, conexao))
{
da.Fill(dt);
}
conexao.Close();
}
var total = dt.Rows.Count;
if (total > 0)
{
for (var i = 0; i < total; i++)
{
var numMesaControle = dt.Rows[i][0];
var idenMesaControle = dt.Rows[i][1];
var mesaControleButton = new Button {Tag = numMesaControle, Content = idenMesaControle, Margin = new Thickness(10,5,10,5),Height = 50, Width = 100, Name = "Mesa" + numMesaControle, Background = Brushes.DarkGreen, Foreground = Brushes.White};
mesaControleButton.Click += MesaControleButton_Click;
Conteiner.Children.Add(mesaControleButton);
}
//geraMaisBotoes(5);
}
else
{
geraMaisBotoes(10);
}
}