Hi!
I learn programming for Microstation with use C#. And I have small problem with levels.
I have a 3 procedures:
1. Update DataGridView with level's informations.
2. Initialize Component.
3. Update Button Click.
But I have problem with this code. After rename level I press button Update (button2_Click), but in my LevelsGrid i see old name.
What am I doing wrong?
public void UpdateLevelsGrid() { LevelsGrid.RowCount = 1; MSApp.ActiveModelReference.Levels.Rewrite(); BCOM.Levels myLevels = MSApp.ActiveModelReference.Levels; int UsedLevelsCount = 0; int LevelsWithPolygonsCount = 0; for (int i = 1; i <= myLevels.Count; i++) { int ElementsCount = 0; int PolygonsCount = 0; LevelsGrid.Rows.Add(myLevels[i].Number, myLevels[i].Name, ElementsCount, PolygonsCount); } }
public SamplePoints() { InitializeComponent(); MSApp = BMI.Utilities.ComApp; UpdateLevelsGrid(); }
private void button2_Click(object sender, EventArgs e) { UpdateLevelsGrid(); }
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point