To all
I am trying to pass inputs from a UI styler (the GUI) to a function to be executed. The GUI is used to select a xls file and specified a tab in this xls. This works fine.
In the apply_cb() function I have
xlFileNameToOpen = nativeFileBrowser0.GetProperties.GetString("Path")
If xlFileNameToOpen = "" Then
theNXMessageBox.Show(theNXMessageBoxTitle, NXMessageBox.DialogType.Error, "Excel file to use is not specified")
errorCode = 1
Else
theLW.WriteLine ("Excel file to process: "& xlFileNameToOpen)
End If
xlSheetNameToUse = strTabSelect.GetProperties.GetString("Value")
If xlSheetNameToUse = "" Then
theNXMessageBox.Show(theNXMessageBoxTitle, NXMessageBox.DialogType.Error, "Tab to use is not specified")
errorCode = 1
Else
theLW.WriteLine ("Tab to use in supplied file: "& xlSheetNameToUse)
End if
' Proceed if everything is OK
If errorCode = 0 Then GetOnWithIt()
where GetOnWithIt() is the function to be executed and uses variables xlFileNameToOpen & xlSheetNameToUse
the 2 variables are defined as follows in the Public Class theGUI
Public Shared xlFileNameToOpen As String
Public Shared xlSheetNameToUse As String
Thanks
Regards
JXB
RE: Passing variables between GUI and function to be executed
Looks like by doing the following works
In the function GetOnWithIt(), define the following variables
Dim xlFileNameToOpen As String = MyGUI.XlsFileSelected
Dim xlSheetNameToUse As String = MyGUI.TabSelected
and in the Public Class MyGUI, function apply_cb() define the following
XlsFileSelected = nativeFileBrowser0.GetProperties.GetString("Path")
If XlsFileSelected= "" Then
theNXMessageBox.Show(theNXMessageBoxTitle, NXMessageBox.DialogType.Error, "Excel file to use is not specified")
errorCode = 1
Else
theLW.WriteLine ("Excel file to process: "& XlsFileSelected)
End If
TabSelected = strTabSelect.GetProperties.GetString("Value")
If TabSelected = "" Then
theNXMessageBox.Show(theNXMessageBoxTitle, NXMessageBox.DialogType.Error, "Tab to use is not specified")
errorCode = 1
Else
theLW.WriteLine ("Tab to use in supplied file: "& TabSelected)
End if
' Proceed if everything is OK
If errorCode = 0 Then GetOnWithIt()
Thanks
Regards