Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think I have a simple question but can't figure it out:
How can I execute an External rule through a button in an iLogic Custom Made User Form that I already have?
See image and code.
Thanks in advance.
AddReference "System.Drawing"
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Public Class WinForm
Inherits System.Windows.Forms.Form
' Declare any thing here that you want to use/access throughout all Subs & Functions
Public oLargerFont As System.Drawing.Font = New Font("Arial", 10)
Public Sub New() ' Creates the new instance
oForm = Me
With oForm
.FormBorderStyle = FormBorderStyle.FixedToolWindow
.StartPosition = FormStartPosition.CenterScreen
.Width = 600
.Height = 300
.TopMost = True
.Font = oLargerFont
.Text = "Windows Form"
.Name = "Windows Form"
.ShowInTaskbar = False
End With
Dim oButton1 As New Button()
With oButton1
.Text = "HML Production Output"
.Top = 25
.Left = 25
.Enabled = True
.AutoSize = True
End With
oForm.Controls.Add(oButton1)
AddHandler oButton1.Click, AddressOf oButton1_Click
Dim oButton2 As New Button()
With oButton2
.Text = "HML Update Tool"
.Top = 125
.Left = 25
.Enabled = True
.AutoSize = True
End With
oForm.Controls.Add(oButton2)
AddHandler oButton2.Click, AddressOf oButton2_Click
' This is the end of the main Sub that defines the Form
End Sub
Private Sub WinForm_FormClosing(ByVal oSender As Object, ByVal oFormCloseEvents As FormClosingEventArgs) Handles Me.FormClosing
If MsgBox("Are you sure you want to close this Form?",vbYesNo+vbQuestion, "CLOSE") = vbYes Then
Else
oFormCloseEvents.Cancel = True
End If
End Sub
Private Sub oButton1_Click(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
' oSender is a Button
MsgBox("You just clicked the [" & oSender.Text & "] button.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
iLogicVb.RunExternalRule("HML - BetaV017")
End Sub
Private Sub oButton2_Click(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
' oSender is a Button
MsgBox("You just clicked the [" & oSender.Text & "] button.",vbOKOnly+vbInformation,"EVENT FEEDBACK")
'iLogicVb.RunExternalRule("HML Update Tool")
End Sub
Private Sub oTextBox_Leave(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
If oSender.Text <> oOriginalText Then 'oSender is a TextBox
MsgBox("The contents of the TextBox have changed.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
End If
End Sub
Private Sub oCheckBox_CheckedChanged(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
If oSender.Checked = True Then 'Sender is a CheckBox
MsgBox("You just Checked the [" & oSender.Text & "] checkbox.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
Else
MsgBox("You just UnChecked the [" & oSender.Text & "] checkbox.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
End If
End Sub
Private Sub oComboBox_SelectionChangeCommitted(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
' oSender is a ComboBox
MsgBox("You just chose " & oSender.Text & " from the ComboBox.",vbOKOnly+vbInformation,"EVENT FEEDBACK")
End Sub
Private Sub oRadioButton1_CheckedChanged(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
If oSender.Checked Then 'oSender is a RadioButton
MsgBox("You just changed the Radio Button option to '" & oSender.Text & "'.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
Else
MsgBox("You just changed the Radio Button option to 'Choice 2'.", vbOKOnly + vbInformation, "EVENT FEEDBACK")
End If
End Sub
' Private Sub oRadioButton2_CheckedChanged(ByVal oSender As System.Object, ByVal oEventArgs As System.EventArgs)
' MsgBox("You just changed the Radio Button option to " & oSender.Text & ".",vbOKOnly+vbInformation,"EVENT FEEDBACK")
' End Sub
End Class
'This is the code that actually shows/runs the Form
Public Class RunMyForm
Private Sub Main
Dim oMyForm As New WinForm
oMyForm.Show
End Sub
End Class
Solved! Go to Solution.