I have an example of a class diagram.
I consult the database and later I create the diagram for example (book, contains NRC, title), etc. What I do is add data to the diagram but it is not reflected.
By clicking on "add property" I want you to update the diagram, Help.
my code is:
SqlDataAdapter adapter;
SqlCommand comm;
if (SelectType == 1)
{
comm = new SqlCommand("SELECT clase,atributo From Activity", con);
}
else
{
comm = new SqlCommand("SELECT clase,atributo From Activity", con);
}
adapter = new SqlDataAdapter(comm);
System.Data.DataSet ds = new System.Data.DataSet("Table");
adapter.Fill(ds);
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
DataTable dt = new DataTable();
dt = ds.Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
ClassList classObj = new ClassList();
classObj.ClassName = dt.Rows[i]["clase"].ToString();
for (int j = i; j < dt.Rows.Count; j++)
{
if (dt.Rows[i]["clase"].ToString() == dt.Rows[j]["clase"].ToString())
{
if (!string.IsNullOrEmpty(dt.Rows[j]["atributo"].ToString()))
{
PropertyList propertyList = new PropertyList();
propertyList.PropertyName = dt.Rows[j]["atributo"].ToString();
classObj.PropertyList.Add(propertyList);
}
if (!string.IsNullOrEmpty(dt.Rows[j]["metodo"].ToString()))
{
MethodList methodList = new MethodList();
methodList.MethodName = dt.Rows[j]["metodo"].ToString();
classObj.MethodList.Add(methodList);
}
}
else
{
i = j - 1;
lstClass.Add(classObj);
break;
}
if (j == dt.Rows.Count - 1)
{
i = j;
lstClass.Add(classObj);
break;
}
}
}
}
return lstClass;
but it does not work diagram.UpdateLayout();