I have been using TaskDialog.Show() to check my code.
When the window pops up, the message is cut off and I can't extend the window to show the whole message.
Is there a way to make the window bigger to see the whole message? Or another better way to see the message?
(using c# to code)
(also not showing a list but that's a different problem)
This is the code I have been using:
FilteredElementCollector levCollector = new FilteredElementCollector(revitDoc);
List<Level> levelsCollection = levCollector.OfClass( typeof( Level ) ) .OfType<Level>() .OrderBy( lev => lev.Elevation ) .ToList();
string stringCollection = levelsCollection.ToString();
TaskDialog.Show("Something",stringCollection);
screenshot to show problem.
HI @mliuAP3CU
ToString() can't work for List, It will return only System.Generic.Collection.
The thing is In the Level class we have no of properties, So not able to convert the List<Level> to String. we need to Select Property which needs to convert as one string variable. Kindly refer to the below code for additional reference.
FilteredElementCollector levCollector = new FilteredElementCollector(revitDoc);
List<Level> levelsCollection = levCollector.OfClass(typeof(Level))
.OfType<Level>()
.OrderBy(lev => lev.Elevation)
.ToList();
string stringCollection = string.Empty;
foreach(Level level in levCollector)
{
stringCollection += level.Name + " " + level.Elevation * 304.8+"\n";
}
TaskDialog.Show("Something", stringCollection);
Reference Image:
Few Links
URL: https://stackoverflow.com/questions/4981390/convert-a-list-to-a-string-in-c-sharp
https://stackoverflow.com/questions/15945924/how-do-i-convert-listclass-to-string
Hope this Helps 🙂
try
{
FilteredElementCollector levCollector = new
FilteredElementCollector(revitDoc);
List<Level> levelsCollection = levCollector.OfClass( typeof( Level ) )
.OfType<Level>()
.OrderBy( lev => lev.Elevation )
.ToList();
string stringCollection = levelsCollection.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message)
return Result.Cancelled;
}
Can't find what you're looking for? Ask the community or share your knowledge.