How to evaluate expression entered in an autocad VBA textbox??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am fairly new to Autocad as well as VBA. This is more of a VBA than Autocad question.. hope its ok to ask here. I have a simple VBA program where I can enter X and Y dimensions, draw boxes, draw circles, create custom layer names etc, but I am having trouble getting my text boxes to interpret anything other than simple numbers.
I want to have it so that the text boxes in my forms can understand inputs such as 60+224 or X+32 where X is previously defined somewhere else and be able to evaluate these expressions rather than interpret as a string.
Also worth noting, I am still mostly at the "copy snippets from the internet and adjust accordingly" phase in my understanding of VBA coding.. OOP is still pretty new to me.
I've been trying both the Eval and Evaluate functions but with no success.
experiments I've tried with a form that has a button, textbox for input and label for output:
Private Sub btnGo_Click()
lblOutput.caption = Eval (txtInput.value)
end Sub
this results in an error : Expected function or Variable
Private Sub btnGo_Click()
Eval(txtInput.value)
lblOutput.caption = txtInput.value
End sub
this results in a runtime error : VBA expression evaluation failed.
Hoping somebody can help me with this.
Thanks