Setting an Initial listbox value

Setting an Initial listbox value

GeeHaa
Collaborator Collaborator
477 Views
2 Replies
Message 1 of 3

Setting an Initial listbox value

GeeHaa
Collaborator
Collaborator
Hi,

Im trying to set an the default selected value of a listbox to "Model". The code highlights "Model" but the .Value and .Text properties remain blank. How do I set these to = "Model". If I select it manually it works.

LBO_Layout.AddItem ("Model")
LBO_Layout.AddItem ("Active")

Dim layout As AcadLayout
Dim layouts As AcadLayouts
Set layouts = ThisDrawing.layouts
For Each layout In layouts
If (Not (layout.Name = "Model")) Then
LBO_Layout.AddItem (layout.Name)
End If
Next layout

LBO_Layout.Text = "Model"

Thanks
0 Likes
478 Views
2 Replies
Replies (2)
Message 2 of 3

GeeHaa
Collaborator
Collaborator
Never Mind

LBO_layout.Setfocus
LBO_Layout.Text = "Model"

Works

Thanks
0 Likes
Message 3 of 3

andrewpuller3811
Advisor
Advisor

try

 

        For i = 0 To LBO_Layout.ListCount - 1
            If LBO_Layout.List(i) = "Model" Then
                LBO_Layout.ListIndex = i
                Exit For
            End If
        Next i



If a post provides a fix for your issue, click on "Accept as Solution" to help other users find solutions to problems they might have that are similar to yours.

Andrew Puller
Maitland, NSW, Australia
Windows 11
Intel core i7 11800 @ 2.30 GHz with 32GB Ram
Civil 3d 2023
0 Likes