got a similar code in autodesk university 2007.
the idea is to return data from a form to lisp.
but it's allways returning (nil)
what i'm missing?
thanks,
e.fernal
[using acad 2010]
'' /////////////////////////////////////////////////////////////////////////// ''
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Public Class Form1
Public bOk As Boolean = False
'' Clicking cancel_button
Private Sub btn_Cancelar_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btn_Cancelar.Click
Me.Close()
End Sub
'' Clicking ok_button
Private Sub btn_Ok_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btn_Ok.Click
bOk = True
Me.Close()
End Sub
<LispFunction("Retornando")> _
Public Function F_Returning(ByVal mRargs As ResultBuffer) As ResultBuffer
Dim form As Form1 = New Form1()
Application.ShowModalDialog(form)
Dim mResbuf As ResultBuffer
Dim t1, t2, t3, t4, t5 As String
t1 = form.txt_01.Text
t2 = form.txt_02.Text
t3 = form.txt_03.Text
t4 = form.txt_04.Text
t5 = form.txt_05.Text
'' testing...
MsgBox(t3)
'' ok until here!!!
If bOk = True Then
'' never happens, even clicking Ok button!!!
MsgBox("Retornou ok")
MsgBox(t1)
mResbuf = New ResultBuffer(New TypedValue(CInt(LispDataType.Text), t1), _
New TypedValue(CInt(LispDataType.Text), t2), _
New TypedValue(CInt(LispDataType.Text), t3), _
New TypedValue(CInt(LispDataType.Text), t4), _
New TypedValue(CInt(LispDataType.Text), t5))
Return mResbuf
End If
'' its allways returning (nil), as bellow, even clicking in Ok button!!!
MsgBox(t5)
mResbuf = New ResultBuffer(New TypedValue(CInt(5019)))
Return mResbuf
End Function
End Class
'' ///////////////////////////////////////////////////////////////////////////////// ''