I am trying to get myself out of the dark ages and convert our Windows Desktop Apps to the web (VB.2015).
I have received some code from a developer to do this and I am not sure that it is correct for multi-users.
Given the below code. It appears to me that the AddInvoice being shared the variables both in the parameters and the inline definitions would not be unique since the class has not
Button event calls the class method fileImporter.readIt(
But the class is never instantiated but just called so a new copy of the class is not created and thus only one set of variables in the machine.Code:Public Class Importer Inherits BasePage ... Protected Sub UploadBtn_Click(sender As Object, e As EventArgs) If Not fileReader.readIt(strPath, dsData, pOutReason) Then messagesList.Add("File Name : " + FileUpLoad1.FileName.ToLower() + pOutReason) : GoTo ExitFunction Else fileImporter.readIt(strPath, profile.OAuthAccessToken, profile.OAuthAccessTokenSecret, profile.RealmId, dsData, messagesList, "Read IIF file") End If End Sub End Class
So is the code incorrect? or do I have more to learn???Code:Public Class FileImpoter(worksheetName As String, OAuthAccessToken As String, OAuthAccessTokenSecret As String, realmId As String, dsData As DataSet, ByRef messagesList As List(Of String), Optional ByRef pOutReason As String = "") As Boolean ... Public Function readIt(...) ... AddInvoice(OAuthAccessToken, OAuthAccessTokenSecret, realmId, messagesList, "Add Invoice", dsData) ... End Function ... Private Shared Function AddInvoice(...) Dim FunRC As Boolean = False Dim Ern As Integer Dim Erd As String If ds1.Tables(0) IsNot Nothing AndAlso ds1.Tables(0).Rows.Count > 0 Then For i = 0 To ds1.Tables(0).Rows.Count - 1 Dim row = ds1.Tables(0).Rows(i) ... Next endif ... End Function End Class




Reply With Quote
