Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to change the iProperties of some parts inside a textbox in a form. I'm using a class to define my form, but it seems I cannot use the iProperties.Value function inside the event handler for clicking a button. I'm getting the following error:
Reference to a non-shared member requires an object reference.
My code looks like this:
Public Sub Main()
Dim oDrawDoc As DrawingDocument = ThisDoc.Document
Dim oName As String = "MyPart.ipt"
'//////// RUN THE FORM ////////
Dim oForm As New WinForm(iLogicVb.Automation, oDrawDoc)
oForm.Show
oDrawDoc.Update
End Sub
Public Class WinForm
Inherits System.Windows.Forms.Form
Public Property oDrawDocint As DrawingDocument
Public Property oTextBox As New System.Windows.Forms.TextBox
'//////// CREATE NEW INSTANCE ////////
Public Sub New(ByVal Iinf As IiLogicAutomation,oDrawDoc As DrawingDocument)
oForm = Me
myIinf = Iinf
oDrawDocint = oDrawDoc
'//////// PARAMETERS FOR THE FORM ////////
With oForm
.FormBorderStyle = FormBorderStyle.FixedToolWindow
.StartPosition = FormStartPosition.CenterScreen
.Width = 250
.Height = 300
.Font = oLargerFont
End With
'//////// CREATES THE BUTTON ////////
Dim oButton1 As New Button()
With oButton1
.Text = "ACTION"
.Top = ((oForm.Bottom - oForm.Top)/2) - (oButton1.Bottom - oButton1.Top)
.Left = (oForm.Width/2) - oButton1.Width +20
.Enabled = True
.AutoSize = True
End With
Dim oLbl As New Label
With oLbl
.Text = "MyPart"
.Top = 20
.Left = 20
.Height = 40
End With
With oTextBox
.Text = "Part No."
.Top = 20
.Left = 120
.Width = 100
.Height = 25
End With
oLbl = oForm.Controls.Add(oLbl)
oForm.Controls.Add(oTextBox)
oForm.Controls.Add(oButton1)
AddHandler oButton1.Click, AddressOf oButton1_Click
End Sub
Public Sub oButton1_Click(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
iProperties.Value(oName, "Project", "Part Number") = oTextBox.Text
End Sub
End Class
Any suggestions of how to modify the iProperties when I click the button?
Solved! Go to Solution.