Oracle, Industry Model
-------------------
For "standard" VB.net, I found this code to create a "Yes/No-Messagebox" and folowing If - else - condition:
Dim rslt As New System.Windows.Forms.DialogResult rslt = MessageBox.Show("Text", "Titel", MessageBoxButtons.YesNo) If rslt = Windows.Forms.DialogResult.Yes Then 'YES pressed Else 'NO pressed End If
How has it to be modified to run in VB.Script in forms?
Solved! Go to Solution.
Oracle, Industry Model
-------------------
For "standard" VB.net, I found this code to create a "Yes/No-Messagebox" and folowing If - else - condition:
Dim rslt As New System.Windows.Forms.DialogResult rslt = MessageBox.Show("Text", "Titel", MessageBoxButtons.YesNo) If rslt = Windows.Forms.DialogResult.Yes Then 'YES pressed Else 'NO pressed End If
How has it to be modified to run in VB.Script in forms?
Solved! Go to Solution.
Solved by Peter2_1. Go to Solution.
@Peter2_1 wrote:
Oracle, Industry Model
-------------------
For "standard" VB.net, I found this code to create a "Yes/No-Messagebox" and folowing If - else - condition:
Dim rslt As New System.Windows.Forms.DialogResult rslt = MessageBox.Show("Text", "Titel", MessageBoxButtons.YesNo) If rslt = Windows.Forms.DialogResult.Yes Then 'YES pressed Else 'NO pressed End IfHow has it to be modified to run in VB.Script in forms?
By saying "VB.Script", since you are asking question on AutoCAD(Map) programming, I assume you mean AutoCAD VBA.
No, you cannot use VB.NET code/syntax with AutoCAD VBA. But with VBA built-in MsgBox (applies to all VBA, AutoCAD, Excel, Word...), you can do basically the same thing. See code sample below:
Public Sub test() Dim answer As VbMsgBoxStyle answer = MsgBox("Please answer this question:" & vbCrLf & vbCrLf & _ "1+1=5" & vbCrLf & vbCrLf & "Yes or No?", vbYesNo + vbDefaultButton2) If answer = vbNo Then MsgBox "Your answer is correct.", vbOKOnly Else MsgBox "Your answer is wrong!", vbOKOnly End If End Sub
Norman Yuan
@Peter2_1 wrote:
Oracle, Industry Model
-------------------
For "standard" VB.net, I found this code to create a "Yes/No-Messagebox" and folowing If - else - condition:
Dim rslt As New System.Windows.Forms.DialogResult rslt = MessageBox.Show("Text", "Titel", MessageBoxButtons.YesNo) If rslt = Windows.Forms.DialogResult.Yes Then 'YES pressed Else 'NO pressed End IfHow has it to be modified to run in VB.Script in forms?
By saying "VB.Script", since you are asking question on AutoCAD(Map) programming, I assume you mean AutoCAD VBA.
No, you cannot use VB.NET code/syntax with AutoCAD VBA. But with VBA built-in MsgBox (applies to all VBA, AutoCAD, Excel, Word...), you can do basically the same thing. See code sample below:
Public Sub test() Dim answer As VbMsgBoxStyle answer = MsgBox("Please answer this question:" & vbCrLf & vbCrLf & _ "1+1=5" & vbCrLf & vbCrLf & "Yes or No?", vbYesNo + vbDefaultButton2) If answer = vbNo Then MsgBox "Your answer is correct.", vbOKOnly Else MsgBox "Your answer is wrong!", vbOKOnly End If End Sub
Norman Yuan
Thanks Norman,
but I don't mean VBA.
I mean this
Use the Script Programmable (ScriptButton) control to execute small scripts. Its function is similar to the Formula TextBox control. You can use VB .NET and the API in the scripts.
taken from here
http://help.autodesk.com/view/MAP/2018/ENU/?guid=GUID-CD132535-11CC-4BB4-80C8-12211DD26843
and other linked pages ...
Thanks Norman,
but I don't mean VBA.
I mean this
Use the Script Programmable (ScriptButton) control to execute small scripts. Its function is similar to the Formula TextBox control. You can use VB .NET and the API in the scripts.
taken from here
http://help.autodesk.com/view/MAP/2018/ENU/?guid=GUID-CD132535-11CC-4BB4-80C8-12211DD26843
and other linked pages ...
Ah, it is IM in Map3D, which I never used in real production. Since IM is exposed its API with .NET and its Form Designer documentation you referred to says VB.NET is used as the scripting language entered via the costum Form Control (ScriptButton), my guess would that .NET's System.Windows.Forms.MessageBox can be used. However, VB.NET still has the old MsgBox "inherited" from classical VB5/6/VBA directly available and can be used in the exactly the same way as my code shows. You can try out with both. But in most cases, I'd be against popping up message during scripting process. If some process is complicated enough to be interrupted and waiting for user interaction, it might be better to processed separately in a customized execution, rather than simple scripting.
Norman Yuan
Ah, it is IM in Map3D, which I never used in real production. Since IM is exposed its API with .NET and its Form Designer documentation you referred to says VB.NET is used as the scripting language entered via the costum Form Control (ScriptButton), my guess would that .NET's System.Windows.Forms.MessageBox can be used. However, VB.NET still has the old MsgBox "inherited" from classical VB5/6/VBA directly available and can be used in the exactly the same way as my code shows. You can try out with both. But in most cases, I'd be against popping up message during scripting process. If some process is complicated enough to be interrupted and waiting for user interaction, it might be better to processed separately in a customized execution, rather than simple scripting.
Norman Yuan
Thanks, with small modifications I could make a little progress. This code is OK
But nevertheless there is a difference between my first vb.net example and your VBa example (brackets, codes, options, ...). This is the information that I'm hoping to find - somewhere, somehow, sometimes ...
Edit: Maybe here are some informations:
Thanks, with small modifications I could make a little progress. This code is OK
But nevertheless there is a difference between my first vb.net example and your VBa example (brackets, codes, options, ...). This is the information that I'm hoping to find - somewhere, somehow, sometimes ...
Edit: Maybe here are some informations:
Can't find what you're looking for? Ask the community or share your knowledge.