Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access other controls from new custom button

Status
Not open for further replies.

lleemon

Programmer
Mar 26, 2002
21
GB
Using Epicor Vista 8.03.409C and can create a new button but when I try to access another control and do 'Test Code' I get errors.

Compiling Custom Code ...
----------errors------------
Error: BC30451 - line 64 (267) - Name 'txtKeyField' is not declared.
Error: BC30451 - line 65 (268) - Name 'txtKeyField' is not declared.
** Compile Failed. **

Here is an example of what I am trying to do for OrderEntry:
Code:
Private Sub btnTestButton_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnTestButton.Click
		'// ** Place Event Handling Code Here ** 
        If txtKeyField.Text.Trim.Length > 0 Then
            MessageBox.Show("Sales Order ID is: " & txtKeyField.Text)
        End If
End Sub

So how can you access other form elements like a normal vb.net app?

Thanks in advance.
 
Figured it out. You have to get the EpiGuid identifier in the properties screen and then declare it. Make sure you declare as right control as well. Regular textbox vs EpiTextbox are two different.

Code:
	Private Sub btnTestButton_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnTestButton.Click
		'// ** Place Event Handling Code Here **
        
        Dim txtKeyField as EpiTextBox = CType(csm.GetNativeControlReference("4fceeeec-518c-4256-932e-34a4c1a584ee"), EpiTextBox)
        
        If txtKeyField.Text.Trim.Length > 0 Then
            MessageBox.Show("Sales Order ID is: " & txtKeyField.Text)
        End If
        
	End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top