Type | Description | |||
objectType as ObjectTypeEnum | An ObjectTypeEnum expression that specifies the list of items being requested. |
The Get method fills the ExShellObjects collection with specific files/folders ( selection or all items ). The Get method can clear the collection, fill it with selected items, or fill it with all files/folders in the control. The Count property indicates the number of elements within the collection. The Item property retrieves a specific member in the collection.
The Get method gets:
nothing, if the objectType parameter is NoItems
all files or folders being listed in the current view, if the objectType parameter is AllItems
all files or folders being listed in the current view, as they are displayed, if the objectType parameter is AllItems Or AsDisplayed
selected files or folders, if the objectType parameter is SelectedItems
selected files or folders as they are displayed, if the objectType parameter is SelectedItems or AsDisplayed
The following VB sample gets the files being selected as they are displayed ( sorted, ... )
With ExShellView1 .Objects.Get (SelectedItems Or AsDisplayed) For i = 0 To .Objects.Count - 1 Debug.Print .Objects(i).Name Next End With
The following VB.NET sample shows how to get the selected files/folder for /NET assembly version:
Dim i As Long = 0, s As String = "" With Exshellview1 .Objects.Get(exontrol.EXSHELLVIEWLib.ObjectTypeEnum.SelectedItems) With .Objects For i = 0 To .Count - 1 Dim sel As exontrol.EXSHELLVIEWLib.exshellobject = .Item(i) ' * The sel indicates the shell object being selected * s = s + sel.Name + vbCrLf Next End With End With If s.Length > 0 Then MessageBox.Show(s, "Selection") Else MessageBox.Show("Empty", "Selection") End If
The following C# sample shows how to get the selected files/folder for /NET assembly version:
string s = ""; exshellview1.Objects.Get(exontrol.EXSHELLVIEWLib.ObjectTypeEnum.SelectedItems); for ( int i = 0; i < exshellview1.Objects.Count; i++ ) { exontrol.EXSHELLVIEWLib.exshellobject sel = exshellview1.Objects[i]; // * The sel indicates the shell object being selected * s = s + sel.Name + "\r\n"; } if (s.Length > 0) MessageBox.Show(s, "Selection"); else MessageBox.Show("Empty", "Selection");
The following VB.NET sample shows how to get the selected files/folder for /COM on Window.Forms version:
Dim i As Long = 0, s As String = "" With AxExShellView1 .Objects.Get(EXSHELLVIEWLib.ObjectTypeEnum.SelectedItems) With .Objects For i = 0 To .Count - 1 Dim sel As EXSHELLVIEWLib.ExShellObject = .Item(i) ' * The sel indicates the shell object being selected * s = s + sel.Name + vbCrLf Next End With End With If s.Length > 0 Then MessageBox.Show(s, "Selection") Else MessageBox.Show("Empty", "Selection") End If
The following C# sample shows how to get the selected files/folder for /COM on Window.Forms version:
string s = ""; axExShellView1.Objects.Get(EXSHELLVIEWLib.ObjectTypeEnum.SelectedItems); for (int i = 0; i < axExShellView1.Objects.Count; i++) { EXSHELLVIEWLib.ExShellObject sel = axExShellView1.Objects[i]; // * The sel indicates the shell object being selected * s = s + sel.Name + "\r\n"; } if (s.Length > 0) MessageBox.Show(s, "Selection"); else MessageBox.Show("Empty", "Selection");
The following VB6 sample shows how to get the selected files/folder for /COM version:
Dim i As Long, s As String s = "" With ExShellView1 .Objects.Get (EXSHELLVIEWLibCtl.ObjectTypeEnum.SelectedItems) With .Objects For i = 0 To .Count - 1 Dim sel As EXSHELLVIEWLibCtl.ExShellObject Set sel = .Item(i) ' * The sel indicates the shell object being selected * s = s + sel.Name + vbCrLf Next End With End With If Len(s) > 0 Then MsgBox s, , "Selection" Else MsgBox "Empty", , "Selection" End If
The following Access sample shows how to get the selected files/folder for /COM version:
Dim i As Long, s As String s = "" With ExShellView1 .Objects.Get (EXSHELLVIEWLib.ObjectTypeEnum.SelectedItems) With .Objects For i = 0 To .Count - 1 Dim sel As EXSHELLVIEWLib.ExShellObject Set sel = .Item(i) ' * The sel indicates the shell object being selected * s = s + sel.Name + vbCrLf Next End With End With If Len(s) > 0 Then MsgBox s, , "Selection" Else MsgBox "Empty", , "Selection" End If
The following VPF sample shows how to get the selected files/folder for /COM version:
local sel s = "" with thisform.ExShellView1 .Objects.Get(1) for i = 0 to .Objects.Count - 1 sel = .Objects.Item(i) s = s + sel.Name + chr(13)+chr(10) next endwith messagebox(s)
The following C++ sample shows how to get the selected files/folder for /COM version:
CString s; CExShellObjects objects = m_shellView.GetObjects(); objects.Get( 1 ); for ( long i = 0; i < objects.GetCount(); i++ ) { CExShellObject sel = objects.GetItem( COleVariant( i ) ); s = s + sel.GetName() + _T("\r\n"); } if ( s.GetLength() > 0 ) MessageBox( s, _T("Selection") ); else MessageBox( _T("Empty"), _T("Selection") );