Message 1 of 5
Form Help for a beginner

Not applicable
10-29-2001
06:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With the assistance of AcadX I am trying to begin the transition to the VBA world. I am posting using a web viewer so I apologize in advance for the format but I need help. The code locks up on setting the Ltest variable. Public Sub SelectLayer()
FrmLayerSelect.Show
End Sub
Private Sub UserForm_Activate()
Dim Elyr As AcadLayer
Dim Flyr As AcadLayer
Dim Blyr As AcadLayer
For Each Elyr In ThisDrawing.Layers
CboEdgeLayr.AddItem Elyr.Name
Next
For Each Flyr In ThisDrawing.Layers
CboFaceLayr.AddItem Flyr.Name
Next
For Each Blyr In ThisDrawing.Layers
CboBackLayr.AddItem Blyr.Name
Next
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim Ltest As Integer
Set Ltest = 0
If CboEdgeLayr.ListIndex <= -1 Then
Set Ltest = 1
End If
If CboFaceLayr.ListIndex <= -1 Then
Set Ltest = 2
End If
If CboBackLayr.ListIndex <= -1 Then
Set Ltest = 3
End If
If Ltest = 0 Then
ThisDrawing.SetVariable "USERS1", CboEdgeLayr.Text
ThisDrawing.SetVariable "USERS2", CboFaceLayr.Text
ThisDrawing.SetVariable "USERS3", CboBackLayr.Text
Unload Me
ElseIf Ltest = 1 Then
MsgBox "Please select an Edge of Pavement layer first", _
vbInformation, _
"Nothing selected"
ElseIf Ltest = 2 Then
MsgBox "Please select a Face of Curb layer first", _
vbInformation, _
"Nothing selected"
ElseIf Ltest = 3 Then
MsgBox "Please select a Back of Curb layer first", _
vbInformation, _
"Nothing selected"
End If
End Sub
FrmLayerSelect.Show
End Sub
Private Sub UserForm_Activate()
Dim Elyr As AcadLayer
Dim Flyr As AcadLayer
Dim Blyr As AcadLayer
For Each Elyr In ThisDrawing.Layers
CboEdgeLayr.AddItem Elyr.Name
Next
For Each Flyr In ThisDrawing.Layers
CboFaceLayr.AddItem Flyr.Name
Next
For Each Blyr In ThisDrawing.Layers
CboBackLayr.AddItem Blyr.Name
Next
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim Ltest As Integer
Set Ltest = 0
If CboEdgeLayr.ListIndex <= -1 Then
Set Ltest = 1
End If
If CboFaceLayr.ListIndex <= -1 Then
Set Ltest = 2
End If
If CboBackLayr.ListIndex <= -1 Then
Set Ltest = 3
End If
If Ltest = 0 Then
ThisDrawing.SetVariable "USERS1", CboEdgeLayr.Text
ThisDrawing.SetVariable "USERS2", CboFaceLayr.Text
ThisDrawing.SetVariable "USERS3", CboBackLayr.Text
Unload Me
ElseIf Ltest = 1 Then
MsgBox "Please select an Edge of Pavement layer first", _
vbInformation, _
"Nothing selected"
ElseIf Ltest = 2 Then
MsgBox "Please select a Face of Curb layer first", _
vbInformation, _
"Nothing selected"
ElseIf Ltest = 3 Then
MsgBox "Please select a Back of Curb layer first", _
vbInformation, _
"Nothing selected"
End If
End Sub