Option Strict Off
Imports System
Imports NXOpen
Imports System.Windows.Forms
Module NXJournal
Public inputdesc As String
Public input As String
Public form_Desc As String
Public button_result As Integer = -1
Public msg As String 'Main Message string decleration to share with form and main module
Sub Main()
' ----------------------------------------------
' User input of Description
' ----------------------------------------------
Dim desc As String
desc_input:
Dim Input_Box As Form1
inputdesc = "Label Text"
form_Desc = "Form Text"
Input_Box = New Form1
Input_Box.ShowDialog()
If button_result = 0 Then
Input_Box.Dispose()
If input = "" Then
MsgBox("User Must Enter a Description")
'msgbox("User Must Enter a Description")
GoTo desc_input
End If
ElseIf button_result = 2 Then
Input_Box.Dispose()
'call dispose_new(filename,saveDialog.FileName)
GoTo end_sub
ElseIf button_result = -1 Then
Input_Box.Dispose()
GoTo end_sub
End If
End If
end_sub:
End Sub
End Module
Public Structure DimensionData
''''''''''''
' Fields used in the form UI and the IShapeCreator
''''''''''''
' name for the dimension
Dim name As String
''''''''''''
' Fields used only in the form UI
''''''''''''
End Structure
Module Input_Box
' Form that asks the user to select a shape
Public Class Form1
Inherits System.Windows.Forms.Form
''''''''''
' PUBLIC METHODS
''''''''''
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents m_OKButton As System.Windows.Forms.Button
Friend WithEvents m_cancelButton As System.Windows.Forms.Button
Friend WithEvents m_inputlabel As System.Windows.Forms.label
Friend WithEvents m_inputTextBox As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.m_OKButton = New System.Windows.Forms.Button
Me.m_CancelButton = New System.Windows.Forms.Button
m_inputlabel = New System.Windows.Forms.label
m_inputTextBox = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'm_OKButton
'
Me.m_OKButton.Location = New System.Drawing.Point(122, 105)
Me.m_OKButton.Name = "m_OKButton"
Me.m_OKButton.TabIndex = 2
Me.m_OKButton.Text = "OK"
'
'm_CancelButton
'
Me.m_CancelButton.Location = New System.Drawing.Point(208, 105)
Me.m_CancelButton.Name = "m_CancelButton"
Me.m_CancelButton.TabIndex = 4
Me.m_CancelButton.Text = "Cancel"
'
'm_inputTextBox
'
Me.m_inputTextBox.Location = New System.Drawing.Point(32, 50)
Me.m_inputTextBox.Name = "m_inputTextBox"
Me.m_inputTextBox.Size = New System.Drawing.Size(250, 60)
Me.m_inputTextBox.TabIndex = 1
Me.m_inputTextBox.Text = "file1" '<-------------- The initial filename displayed
'
'm_inputLabel
'
Me.m_inputlabel.Location = New System.Drawing.Point(32, 30)
Me.m_inputlabel.Name = "m_inputlabel"
Me.m_inputlabel.Size = New System.Drawing.Size(120, 16)
Me.m_inputlabel.TabIndex = 5
Me.m_inputlabel.Text = inputdesc
'Me.m_inputlabel.font.bold = true
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(320, 140)
Me.Controls.Add(Me.m_OKButton)
Me.Controls.Add(Me.m_CancelButton)
Me.Controls.Add(Me.m_inputTextBox)
Me.Controls.Add(Me.m_inputlabel)
Me.Name = "Form1"
Me.Text = form_desc
Me.ResumeLayout(False)
nxopenui.formutilities.setapplicationicon(Me)
End Sub
#End Region
''''''''''
' PRIVATE METHODS ADDED BY HAND
''''''''''
Public Sub m_OKButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_OKButton.Click
'msgbox(Me.m_inputTextBox.Text)
input = Me.m_inputTextBox.text
button_result = 0
MyBase.dispose()
End Sub
Private Sub m_CancelButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_CancelButton.Click
button_result = 2
MyBase.dispose()
End Sub
Private Sub txt_keypress(ByVal system As System.Object, ByVal e As KeyPressEventArgs) Handles m_inputTextBox.KeyPress
If e.KeyChar = Chr(Keys.Enter) Then
Call m_OKButton_Click("enter", e)
End If
End Sub
''''''''''
' PRIVATE DATA
''''''''''
End Class
End Module