Hello
How can i get a basepoint of Autocad into 2 textboxes in vba?
I have a button to pick a point into Autocad
And next to that i have 2 textboxes:
1 for the x.value
2 for the y.value
Ill send you a picture of my frame.
How can i do this? the code i have already is:
Private Sub cmdInsertVAZ_Click()
If frmKast.chkCoGeavanceerd And frmKast.chkVooraanzicht = True Then
Call Mod_VarFormules
Call Mod_VAZGeavanceerd
Call Mod_VAZGeavanceerd2
Call Mod_VAZAlgemeen
MsgBox " Geef het BASISPUNT voor het VOORAANZICHT in aub."
InvoegpuntVAZ = ThisDrawing.Utility.GetPoint(, vbCr & "Insertion point: ")
frmKast.Show
End If
End Sub
thanks
Solved! Go to Solution.
Solved by kasperwuyts. Go to Solution.
'add x coordinate to textbox
Textbox1.text = invoegpuntVaz(0)
'add y coordinate to textbox
Textbox2.text = invoegpuntVaz(1)
How do i need to at this in my program? if i add it in the end i get a compile error
Add a sub in the code of your form. The three points should be defined at the beginning of the code, before any subs:
Dim InvoegpuntVAZ(0 to 2) as double
Dim InvoegpuntZAZ(0 to 2) as double
Dim InvoegpuntBAZ(0 to 2) as double
Let's suppose your first 'Handmatig' button is called cmdVooraanzichtHandmatig. The textbox that should contain the X-coordinate here is called txtVooraanzichtX, the one containing the Y-coordinate is called txtVooraanzichtY
You would have a sub like this:
Sub cmdVooraanzichtHandmatig_Click()
Me.hide
Application.Visible = True
InvoegpuntVAZ = ThisDrawing.Utility.GetPoint(, " Geef het BASISPUNT voor het VOORAANZICHT in aub.")
'add x coordinate to textbox
txtVooraanzichtX.Text = InvoegpuntVAZ(0)
'add y coordinate to textbox
txtVooraanzichtY.Text = InvoegpuntVAZ(1)
Me.show
End Sub
Then you can copy the sub two times, simply replacing 'Vooraanzicht' with 'Zijaanzicht', 'invoegpuntVAZ' with 'invoegpuntZAZ' etcetera
I've added a working sample in a dwg.