WTH happeneed to my form?

WTH happeneed to my form?

mslosar
Advisor Advisor
336 Views
1 Reply
Message 1 of 2

WTH happeneed to my form?

mslosar
Advisor
Advisor

I had an add-in created which launched a form. On the form were/are 4 radio buttons to choose units/precision. Just a 1-4 choice.

 

It WAS working. In tweaking underneath code that had nothing to do with the dialog - the dialog stopped functioning correctly - this is the code i've added:

 

Imports Inventor

Public Class CUForm2
    Dim oUnits As String
    Dim otext As String

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        If RBin.Checked = True Then
            oUnits = "ft-in"
        End If
        If RBmm.Checked = True Then
            oUnits = "mm"
        End If
        If RBmm1.Checked = True Then
            oUnits = "mm1"
        End If
        If RBmm2.Checked = True Then
            oUnits = "mm2"
        End If

        MsgBox("unit type " & oUnits)

    End Sub

 i tried a new form from scratch and i'm getting the same problem.

 

Basically, the if/thens are firing before the dialog appears. The dialog, does appear, but regardless of what you choose, none of the if statements are catching..  (i know i'm supposed to do me.close at the end, but nothing is working.

 

I've also tried the new statement as

Private Sub CUnits_Click(sender As Object, e As EventArgs) Handles CUnits.Click

 

I've tried that with elseif's and select case and same thing happenes. I don't see what i'm missing here.

 

Help would be appreciated as i'm clearly missing something here.

 

Thanks!

 

 

0 Likes
337 Views
1 Reply
Reply (1)
Message 2 of 2

rjay75
Collaborator
Collaborator

The if/thens should be located inside of the CUnits_Click method. The new method executes when the dialog is created before it's shown. Any logic you want to have happen after the CUnits is clicked should be inside of the CUnits_Click method.

0 Likes