SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Inserts a new item.
VB.NET | ItemIndex = object.Insert(ByVal Text As String, ByVal InsertIndex As Integer) As Integer |
VB | ItemIndex = object.Insert(ByVal Text As String, ByVal InsertIndex As Long) As Long |
C#.NET | int ItemIndex = object.Insert(string Text, int InsertIndex); |
VC++ | long ItemIndex = object->Insert(_bstr_t Text, long InsertIndex); |
C | HRESULT object->raw_Insert(BSTR Text, long InsertIndex, long* ItemIndex); |
object
Text
The text to be added as cell text of the first (or only) column of the item.
InsertIndex
The zero-based index of the position where the new item will be inserted. Specify -1 or the index of the last item + 1 to add the item at the end of the list.
ItemIndex
Returns the zero-based index of the inserted item.
The Insert method inserts a new item.
New items added using the Insert method are added at the position described by InsertIndex. By default, new items are added at level 0. Use the Item.Level property to change an item's level.
Items can be inserter after a specific item using the Items.InsertAfter method.
If many items have to be added, the BulkUpdate property can be used to indicate a mass-update, which is significantly faster.
Once an item has been added, the Cell.Text property can be used to change the text for any of the available cells.
Items can be added at the end using the Items.Add method. Items can be deleted using the Items.Remove or Items.Clear methods.
When a control is populated using Items.Add or Insert, the Items.RecalcHorizontalExtent method can be used to have the control calculate the optimal horizontal scrolling area so scroll bars are enabled, depending on the Scrollbars property.
The drop down portion is automatically hidden when the combo box contents are changed using this method. The DropDown.SuppressOn method can be used to suppress hiding the drop down portion when adding/inserting items.
countryList.Items.Add("Portugal") countryList.Items.Add("Russia") countryList.Items.Add("Sweden") countryList.Items.Add("Singapore") countryList.Items.Add("United Kingdom") countryList.Items.Add("Yugoslavia") countryList.Items.Add("South Africa") countryList.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending) countryList.Items.Insert("United States", 0) countryList.Items.Selection = 0 countryList.Columns.MakeOptimal(0) countryList.Items.RecalcHorizontalExtent(0) End Sub Private Sub AddCompany(ByVal CompName As String, ByVal NotUsed1 As String, ByVal NotUsed2 As String, ByVal Address As String, ByVal City As String, ByVal State As String, ByVal ZIP As String, ByVal Country As String, ByVal Phone As String, ByVal Fax As String)
.Add "Portugal" .Add "Russia" .Add "Sweden" .Add "Singapore" .Add "United Kingdom" .Add "Yugoslavia" .Add "South Africa" .Sort -1, 0, sortSftBoxAscending .Insert "United States", 0 .Selection = 0 End With CountryList.Columns.MakeOptimal 0 CountryList.Items.RecalcHorizontalExtent 0 End Sub
countryList.Items.Add("Portugal"); countryList.Items.Add("Russia"); countryList.Items.Add("Sweden"); countryList.Items.Add("Singapore"); countryList.Items.Add("United Kingdom"); countryList.Items.Add("Yugoslavia"); countryList.Items.Add("South Africa"); countryList.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending); countryList.Items.Insert("United States", 0); countryList.Items.Selection = 0; countryList.Columns.MakeOptimal(0); countryList.Items.RecalcHorizontalExtent(0); } private void AddCompany(string CompName, string NotUsed1, string NotUsed2, string Address, string City, string State, string ZIP, string Country, string Phone, string Fax)
vCountryList->Items->Add("Portugal"); vCountryList->Items->Add("Russia"); vCountryList->Items->Add("Sweden"); vCountryList->Items->Add("Singapore"); vCountryList->Items->Add("United Kingdom"); vCountryList->Items->Add("Yugoslavia"); vCountryList->Items->Add("South Africa"); vCountryList->Items->Sort(-1, 0, sortSftBoxAscending); vCountryList->Items->Insert("United States", 0); vCountryList->Items->Selection = 0; vCountryList->Columns->MakeOptimal(0); vCountryList->Items->RecalcHorizontalExtent(0); return TRUE; // return TRUE unless you set the focus to a control }
See Also SftBoxItems Object | Object Hierarchy