Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm trying to set the name of a selected part occurrence into a radiobutton of a form.
I'm using a shared variable to get the name from another rule. Everything works well, but in the end the name of the occurrence is missing in the form.
Does anyone know how to get the string I want into the form?
My code looks like this:
AddReference "System.Drawing" Imports System.ComponentModel Imports System.Drawing Imports System.Windows.Forms
Public Sub Main() '//////// GET THE OCCURRENCE NAME //////// Dim oOcc As String = SharedVariable("Occurrence") '//////// RUN THE FORM //////// Dim oForm As New WinForm oForm.Show End Sub
Public Class WinForm Inherits System.Windows.Forms.Form Public oLargerFont As System.Drawing.Font = New Font("Arial", 10) '//////// CREATE NEW INSTANCE //////// Public Sub New oForm = Me '//////// PARAMETERS FOR THE FORM //////// With oForm .FormBorderStyle = FormBorderStyle.FixedToolWindow .StartPosition = FormStartPosition.CenterScreen .Width = 300 .Height = 700 .TopMost = True .Font = oLargerFont .Text = "Component Select" .Name = "Components" .ShowInTaskbar = False End With Dim oButton1 As New Button() With oButton1 .Text = "MODIFY" .Top = 25 .Left = 25 .Enabled = True .AutoSize = True End With oForm.Controls.Add(oButton1) AddHandler oButton1.Click, AddressOf oButton1_Click Dim oOptions As New List(Of String) oOptions.AddRange({"Option 1","Option 2","Option 3"}) Dim oGroupBox As GroupBox = New GroupBox() oGroupBox.Left = 25 oGroupBox.Width = 150 oGroupBox.Top = oButton1.Bottom + 20 oGroupBox.Height = 100 oGroupBox.Text = "Choose" oForm.Controls.Add(oGroupBox) '//////// RADIOBUTTON PARAMETERS //////// Dim oRadioButton1 As New RadioButton() oGroupBox.Controls.Add(oRadioButton1) oRadioButton1.Text = oOcc.Name oRadioButton1.Top = 20 oRadioButton1.Left = 35 oRadioButton1.AutoSize = True End Sub Private Sub oButton1_Click(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs) MsgBox("Action triggered",vbOKOnly+vbInformation,"EVENT FEEDBACK") End Sub End Class
Solved! Go to Solution.