
este es el codigo que estoy usando:
int y = 100;
int y2 = 1;
foreach (DataRow row in dt.Rows)
{
GroupBox grupo = new GroupBox();
grupo.Text = row[0].ToString();
grupo.Size = new System.Drawing.Size(1150, 100);
grupo.Location = new System.Drawing.Point(10, y);
this.Controls.Add(grupo);
string comparar = row[1].ToString();
if (comparar == "1")
{
using (SqlConnection con = new SqlConnection(datosConexion))
{
con.Open();
string textoCmd2 = "SELECT Articulo FROM [Norte].[dbo].[Componentes] where Nombre = '" + row[0].ToString() + "'";
SqlCommand cmd2 = new SqlCommand(textoCmd2, con);
cmd2.ExecuteNonQuery();
con.Close();
SqlDataAdapter da2 = new SqlDataAdapter(cmd2);
da2.Fill(dt2);
}
foreach (DataRow row2 in dt2.Rows)
{
RadioButton btn = new RadioButton();
btn.Text = row2[0].ToString();
btn.Size = new System.Drawing.Size(130, 40);
btn.Location = new System.Drawing.Point(y2, 40);
grupo.Controls.Add(btn);
y2 = y2 + 135;
ToolTip buttonToolTip = new ToolTip();
buttonToolTip.SetToolTip(btn, btn.Name.ToString());
}
dt2.Clear();
y2 = 1;
}
else
{
RadioButton btn = new RadioButton();
btn.Text = row[0].ToString();
btn.Size = new System.Drawing.Size(120, 40);
btn.Location = new System.Drawing.Point(1, 40);
grupo.Controls.Add(btn);
}
y = y + 100;
}
}
catch
{
MessageBox.Show("No hay conexion", "No se puede descargar la informacion del servidor ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
Gracias por responder, hasta ponto.
