Message 1 of 2
Modelless Second Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Developer,
I am trying to use the modelless form to be modify the model although the form was open.
I can access the model to modify when the first form was open.
I cannot access the model when the form2 is up.
Kindly help me, How should be do for form2 to be access the model?
Below code is how I load the form2,
using System;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ModelessForm_IdlingEvent.CS
{
public partial class ModelessForm : Form
{
private Request m_request;
public Request Request
{
get
{
return m_request;
}
private set
{
m_request = value;
}
}
public ModelessForm()
{
InitializeComponent();
Request = new Request();
}
private void EnableCommands(bool status)
{
foreach (Control ctrl in this.Controls)
{
ctrl.Enabled = status;
}
if (!status)
{
this.btnExit.Enabled = true;
}
}
private void MakeRequest(RequestId request)
{
Request.Make(request);
DozeOff();
}
private void DozeOff()
{
EnableCommands(false);
}
public void WakeUp()
{
EnableCommands(true);
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
private void btn_form2_Click(object sender, EventArgs e)
{
this.Close();
Form2 f2 = new Form2();
f2.ShowDialog();
}
}
}Thanks Advance,
Naing Oo