Get item text of property grid

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
sovan81
Posts: 2
Joined: 23 Feb 2010, 11:54

Get item text of property grid

Post by sovan81 » 03 Mar 2010, 14:32

Hi,

I am geting property grid object values from code

foreach(PropertyDescriptor pd in pdc)
{
object objVal = pd.GetValue(propGrid.SelectedObject);
}

Now I want to get text part also.

Thanks & Regards
Sovan Bera

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Get item text of property grid

Post by support » 03 Mar 2010, 16:47

Hello.
The property grid object represents the window where the properties of the selected entity can be viewed and modified. You don't need access entities' properties via property grid, you can access them directly from CADImage object via CADImage.Converter.Entities property. Please see help system.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

thc1nk
Posts: 1
Joined: 09 Apr 2010, 16:39

Re: Get item text of property grid

Post by thc1nk » 09 Apr 2010, 17:45

Dear Alexander,

this is my first post ever and additionally I'm a newby in VB.NET - so pls. excuse, if the answer on my following question is self-explanatory for everybody else:

I also want to retrieve different properties of an entity selected in the CadEditorControl.
What I did, is to check, if there is any ojecct either in CadEditorControl, CADPictureBox PropertyGrid or CADImage.

I followed your advice from aboveds post to see for a Converter-object in CADImage-class - it is not there.

Pls. give some hints (or better: a short code-example), how to proceed.

By the way: I've purchased a licence for the professional version of CADImport.NET last monday.

Thanks in advance, Thomas

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Get item text of property grid

Post by support » 15 Apr 2010, 18:30

Hello.
Selected entity or entities can be found in CADImage.SelectedEntities collection. When you use CADEditorControl this collection can be accessed like shown in the following code sample. Please set the code to the new button in CADEditorControl demo project.

Code: Select all

     Dim cadImage As CADImport.CADImage
     Dim line As CADImport.CADLine

     cadImage = Me.cadEditorControl.Image

     If Not (cadImage Is Nothing) Then
         If Not (cadImage.SelectedEntities Is Nothing) Then
             MessageBox.Show(cadImage.SelectedEntities.Count.ToString())
         End If
     End If
Compile the project, create one or more entities then select some and click to button. You will see how many entities you selected.
You can access any property of any entity in collection. For example the following change in code:

Code: Select all

     ...
     REM MessageBox.Show(cadImage.SelectedEntities.Count.ToString())
     If (cadImage.SelectedEntities(0).EntType = CADImport.EntityType.Line) Then
         line = cadImage.SelectedEntities(0)
         MessageBox.Show(line.Handle.ToString())
     End If
     ...
will show selected entity's handle property value if selected entity is Line.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply