Set the Values to the form control in Module

Hi All

I am using Visual Studio 2008

Imports RMA.Rhino
Imports RMA.OpenNURBS
Imports RMA.Rhino.RhUtil

Module Procedures
Dim frmTemp As New frmDiaPlacementOptions

Public Sub GetBaseSurface()
    Dim getsurface As New RMA.Rhino.MRhinoGetObject
    getsurface.SetCommandPrompt("Select Base Surface")
    getsurface.SetGeometryFilter(RMA.Rhino.IRhinoGetObject.GEOMETRY_TYPE_FILTER.surface_object Or RMA.Rhino.IRhinoGetObject.GEOMETRY_TYPE_FILTER.polysrf_object)
    getsurface.GetObjects(1, 1)
    If (getsurface.CommandResult() <> IRhinoCommand.result.success) Then
        Return
    End If
    frmTemp.txtBaseSurface.Text = getsurface.Object(0).m_uuid.ToString
    frmTemp.txtBaseSurface.Refresh()
    Return
End Sub

Why i am not able to set the ObjectID or any text to the textbox which is on my usercontrol

Do you get any sort of error message?

And, shouldn’t you have parentheses after ToString?

Nothing

but if i Make

Dim frmTemp As frmDiaPlacementOptions

instead of

Dim frmTemp As New frmDiaPlacementOptions

then Rhino4 crashes

Sorry I m new to VB.NET i dont have any idea about parentheses

frmTemp.txtBaseSurface.Text = getsurface.Object(0).m_uuid.ToString
Should probably be
frmTemp.txtBaseSurface.Text = getsurface.Object(0).m_uuid.ToString()

Nope,

Even if i do this :

frmTemp.txtBaseSurface.Text = “Louis”

then its not adding the text to TextBox

Sorry, then I have no idea…

Do you mean that if you do a debug.print of frmTemp.txtBaseSurface.Text it doesn’t print out Louis?
Or do you mean that your form on the screen doesn’t change it’s display in the txtBaseSurface field to show Louis?

AIW,

txtBaseSurface is a textbox object which is on form frmTemp

I am not able to set the text to txtBaseSurface from Module.

I’m thinking you are running up against VB’s not-real-intuitive way of handling data accessibility between modules and classes. Check out data definition properties like “Public”, “Shared”, “Friend”, “Partial”, etc. Data scoping can get tricky sometimes.

AIW,

Found the way
I have placed some Variables in one Module

like if i want to set the text to text1 in form1 then first i set the value to variable in module like varText = “Louis” and then in form1 i put code text1.text = varText

Glad you got it working!