Leave winform open when create a new level

Leave winform open when create a new level

vanlion
Advocate Advocate
598 Views
5 Replies
Message 1 of 6

Leave winform open when create a new level

vanlion
Advocate
Advocate
Hello,
Is have a question. I have a working winform that can create a new level and viewplan. When you press the OK button the winform makes the level.

But is it also possible to let the winform stays open after clicking OK. So you can make a new level again without opening the form again from the ribbon panel.

Maybe something with an event handler?

Anyone with a simple Idea?

Thanks!
0 Likes
Accepted solutions (1)
599 Views
5 Replies
Replies (5)
Message 2 of 6

jeremytammik
Autodesk
Autodesk

That is a simple .NET Windows.Forms question and has nothing to do with the Revit API.

 

Yes, you can redefine the behaviour on clicking the OK button, so that the form remains open.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 6

vanlion
Advocate
Advocate

Hi Jeremy,

 

Good to hear that it is possible and a simple .NET solution.

 

I searched on the internet but can't find the right function that can do this.

 

Do maybe have a "google" search idea 😉

 

The rest i will figure out myself.

 

 

0 Likes
Message 4 of 6

jeremytammik
Autodesk
Autodesk
Accepted solution

Absolutely trivial, man!

 

".net redefine ok button action"

 

https://duckduckgo.com/?q=.net+redefine+ok+button+action

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6

vanlion
Advocate
Advocate

So simple but it's working very well.

 

Thanks for the quick response and help!

0 Likes
Message 6 of 6

vanlion
Advocate
Advocate

Hi Jeremy,

 

Last question about this one. The problem to not close the form is solved.

 

But what code do i need when you press Add, it adds the level to the active document and when you type again a new level name and height in the form it also adds it to the document. So you can make very quick new levels.

 

It now only added the last given Level

 

Capture.JPG

 

Or do you have to store the new created levels to a list and do a for loop to add them?

 

This is the last part i try to understand in how Revit handles C# 🙂

 

Thanks

0 Likes