Page 1 of 1

Stop loading of Add-In on Add-in Load

Posted: Thu Aug 24, 2023 4:10 am
by lukekfrost
Good Morning All,

I am in the final stages of creating an Add-In for internal use which requires users to login to the Add-In prior to using it. I have got the following code which I have put in the ConnectToSW Function.

'Check if initial setup has been run
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Snowman Design\CMD_SW_Add-in", "initial", Nothing) = 1 Then
Dim OpeningForm As New frmInitialSetup
If OpeningForm.ShowDialog = Windows.Forms.DialogResult.OK Then
ConnectToSW = True
Else
'Stop the loading of the Add-In and unload it
MsgBox("You are required to login to this Add-In for it to work")
End If
Else
Dim OpeningForm As New FrmLogin
If OpeningForm.ShowDialog = Windows.Forms.DialogResult.OK Then
ConnectToSW = True
End If
End If

The end result that i am trying to achieve is that when the add-in is loaded, either automatically on SOLIDWORKS startup or just a one off instance when SOLIDWORKS is running, a login dialogue box is displayed and if the dialogresult is anything other than ok then the add-in is unloaded.

I have tried things like calling the DissconnectFromSW or RemoveTaskPane Functions, however i am getting no joys. Hopefully someone can help with this one.

Just for clarification i am using Visual Studio 2019 and vb.net to write the add-in and not vba.

As always thank you in advance for your help.

Luke

Re: Stop loading of Add-In on Add-in Load

Posted: Thu Aug 24, 2023 11:27 am
by bnemec