Grasshopper

algorithmic modeling for Rhino

Is there any way to recompute custom code section in VB component ? 

So the real problem behind this question is : when I use close button on my form, it wont reload cause it is declared in custom code section which wont recompute with owner.expiresolution(true). Am I missing something ? I cannot declare buttons and form and all that stuff in run script, cause it doesnt accept withevents property. My idea is to recompute all the script component stuff...

This is my code :

Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByRef A As Object)

If x = True Then
frm.Controls.Add(b1)
t1.location = p0
frm.Controls.add(t1)
frm.show
a = zmienna
Else
frm.Dispose
End If

End Sub

'<Custom additional code>
Dim frm As New system.windows.Forms.Form
WithEvents b1 As New system.Windows.Forms.Button
WithEvents t1 As New system.Windows.Forms.TextBox
Dim p0 As New system.Drawing.Point(30, 30)
Dim zmienna As String

Private Sub b1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b1.click

zmienna = t1.Text
owner.ExpireSolution(True)

End Sub

 

Views: 572

Replies to This Discussion

ok, problem solved :

Private Sub RunScript(ByVal x As Object, ByVal y As Object, ByRef A As Object)

If x = True Then
frm.MinimizeBox = False
frm.MaximizeBox = False
frm.Controls.Add(b1)
t1.location = p0
frm.Controls.add(t1)
frm.show
a = zmienna
Else
frm.hide
End If

End Sub

'<Custom additional code>
WithEvents frm As New system.windows.Forms.Form

Private Sub Form1_FormClosed(sender As Object, e As windows.Forms.FormClosingEventArgs) _
Handles frm.FormClosing
e.Cancel = True
End Sub

WithEvents b1 As New system.Windows.Forms.Button
WithEvents t1 As New system.Windows.Forms.TextBox
Dim p0 As New system.Drawing.Point(30, 30)
Dim zmienna As String

Private Sub b1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b1.click
zmienna = t1.Text
owner.ExpireSolution(True)
End Sub

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service