Adding an Image to a Shop Employee Dashboard

I Epicor 9 we had a Shop Employee Dashboard which utilized an EpiPictureBox. When a row (Emp.ID) was selected in the grid that employees photo would populate.
I cannot get the photo to populate in Epicor 10.2.400.14

Below is the code that was used in E9. Any suggestions as to why it is not working in E10?
Module Script
'// ** Wizard Insert Location - Do Not Remove ā€˜Begin/End Wizard Added Module Level Variablesā€™ Comments! **
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
Private DBTVP As Object
Private WithEvents iTrackEvents As ITrackerEvents
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete ā€˜Begin/End Wizard Added Variable Intializationā€™ lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
DBTVP = DBTVP_330f367d_3146_472e_b789_54188ba1c250
iTrackEvents = DBTVP
'MessageBox.show(ā€œInitializing Custom Codeā€¦ā€)
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete ā€˜Begin/End Wizard Added Object Disposalā€™ lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
DBTVP = Nothing
iTrackEvents = Nothing
'// End Custom Code Disposal
End Sub

Private sub iTrackEvents_TrackerQueryRowChanged(args As queryRowChangedEventArgs) handles iTrackEvents.trackerQueryRowChanged
    Dim filePath As String
    Dim fileName As String = DBTVP.DBView.DataView (args.nextViewIndex)("empBasic.photoFile")
    If fileName <> "" then             
        filePath = "\\LSIEpicor10\EpicorData\EmpPhoto\LSI68332\" & fileName & ".bmp"
    Else
        filePath = "blank"
    End if 
	MessageBox.show(filePath) 
    displayEmpPhoto(filePath)         
End sub

Private sub displayEmpPhoto(byVal fileName As String)
    If fileName <> "blank" then
         picEmpPhoto.Image = System.Drawing.Image.FromFile(fileName) 
    Else
        picEmpPhoto.Image = ""
    End if         
End sub

End Module
Any suggestions are appreciated.
Thanks
Carol

First suggestion is to format your code properly so that we can read it :wink:

Next, where is it breaking? Are you getting to the point of showing your filepath?
It would definitely be worth your effort to move away from VB and towards C#. C# is preferred for Epicor customizations.

1 Like

Lol ā€¦ I was lucky I found the time to copy and paste what we have in there. Its been a bit crazy since we converted to E10 from E9. It seems like all the testing we did was for naught because many of the things we repaired & rewrote and had working in our test environment did not work when we converted and went live. It has been pretty ugly. There is only one of me and Iā€™m ready for a vacation. :slight_smile:
Anyway back to the issue at hand. In answer to your question, is it getting to the point of showing the filepath? No it is not.
I can attempt to rewrite it in C# and see what results I get. I didnā€™t write the initial code but I was hoping the existing code would just need a bit of a tweak.
Thanks for your advice / input.
Carol

Ok I re-wrote in c# since my vb is about as rusty as it gets (and I didnā€™t test it or anything, so bear with me) but here:

public class Script
{
// ** Wizard Insert Location - Do Not Remove ā€˜Begin/End Wizard Added Module Level Variablesā€™ Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
private object DBTVP;
private ITrackerEvents iTrackEvents;


	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete ā€˜Begin/End Wizard Added Variable Intializationā€™ lines **
		// Begin Wizard Added Variable Intialization
		// End Wizard Added Variable Intialization
		// Begin Custom Method Calls
		this.iTrackEvents.TrackerQueryRowChanged += new Ice.Lib.Framework.TrackerQueryRowChangedHandler(this.iTrackEvents_TrackerQueryRowChanged);
		this.DBTVP = DBTVP_330f367d_3146_472e_b789_54188ba1c250
		iTrackEvents = DBTVP;
		//MessageBox.show(ā€œInitializing Custom Codeā€¦ā€)
		// End Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete ā€˜Begin/End Wizard Added Object Disposalā€™ lines **
		// Begin Wizard Added Object Disposal
		// End Wizard Added Object Disposal
		// Begin Custom Code Disposal
		this.iTrackEvents.TrackerQueryRowChanged -= new Ice.Lib.Framework.TrackerQueryRowChangedHandler(this.iTrackEvents_TrackerQueryRowChanged);
		this.DBTVP = null;
		this.iTrackEvents = null;
		// End Custom Code Disposal
	}
	
	private void iTrackEvents_TrackerQueryRowChanged(queryRowChangedEventArgs args)
	{
		string filePath;
		string fileName = DBTVP.DBView.DataView(args.nextViewIndex)("empBasic.photoFile");
		if (fileName != "")
			filePath = @"\\LSIEpicor10\EpicorData\EmpPhoto\LSI68332\" + fileName + ".bmp";
		else
			filePath = "blank";
		MessageBox.show(filePath);
		displayEmpPhoto(filePath);
	}

	private void displayEmpPhoto(string fileName)
	{
		if (fileName != "blank")
			picEmpPhoto.Image = System.Drawing.Image.FromFile(fileName);
		else
			picEmpPhoto.Image = "";
	}
	
}

The only thing really different I did was handle the event in C# vs. the vb way of doing it. I think that might have been the issue, but play around with that and see if it gets you closer

Aaron ā€¦ thank you so much. I havenā€™t had time to get back to this yet, but when I do I will let you know what my results are.

Carol