New to X# and need some direction
New to X# and need some direction
Yes I have got that sorted in the meantime, the issue was that I have referenced v11 of Json and not v7
So that works, thaks to all. Now I have both VS C# and XIDE X# stopping at the same point - good and bad Good that it looks like the sample is not correct. So now comes the new challenge
XIDE X#:
error XS0103: The name 'companyFiles' does not exist in the current context 74,20 Form1.prg MYOB_Test1
VS with C#:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'AccountService' could not be found (are you missing a using directive or an assembly reference?) WindowsFormsApp1 C:Usersintersoft.SBSsourcereposWindowsFormsApp1WindowsFormsApp1Program.cs 30 Active
Did you get this? If not
So that works, thaks to all. Now I have both VS C# and XIDE X# stopping at the same point - good and bad Good that it looks like the sample is not correct. So now comes the new challenge
XIDE X#:
error XS0103: The name 'companyFiles' does not exist in the current context 74,20 Form1.prg MYOB_Test1
VS with C#:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'AccountService' could not be found (are you missing a using directive or an assembly reference?) WindowsFormsApp1 C:Usersintersoft.SBSsourcereposWindowsFormsApp1WindowsFormsApp1Program.cs 30 Active
Did you get this? If not
New to X# and need some direction
using System.Windows.Forms
#using System.Drawing
#using MYOB.AccountRight.SDK
#using MYOB.AccountRight.SDK.Services
#using MYOB.AccountRight.SDK.Services.GeneralLedger
#using MYOB.AccountRight.SDK.Contracts
//USING MYOB.AccountRight.SDK
//USING MYOB.AccountRight.SDK.Services
//USING MYOB.AccountRight.SDK.Contracts
CLASS BasicForm INHERIT System.Windows.Forms.Form
PROTECT oTextBox AS System.Windows.Forms.TextBox
PROTECT oOKButton AS System.Windows.Forms.Button
// User code starts here (DO NOT remove this line) ##USER##
CONSTRUCTOR()
SUPER()
SELF:InitializeForm()
RETURN
METHOD InitializeForm() AS VOID
// IDE generated code (please DO NOT modify)
SELF:oTextBox := System.Windows.Forms.TextBox{}
SELF:oOKButton := System.Windows.Forms.Button{}
SELF:SuspendLayout()
SELF:ClientSize := System.Drawing.Size{392 , 264}
SELF:Location := System.Drawing.Point{100 , 100}
SELF:Name := "BasicForm"
SELF:Text := "Basic form application"
SELF:oTextBox:Location := System.Drawing.Point{8 , 48}
SELF:oTextBox:Name := "TextBox"
SELF:oTextBox:Size := System.Drawing.Size{341 , 20}
SELF:oTextBox:TabIndex := 1
SELF:Controls:Add(SELF:oTextBox)
SELF:oOKButton:Click += SELF:OKButtonClick
SELF:oOKButton:Location := System.Drawing.Point{280 , 232}
SELF:oOKButton:Name := "OKButton"
SELF:oOKButton:Size := System.Drawing.Size{104 , 24}
SELF:oOKButton:TabIndex := 0
SELF:oOKButton:Text := "&OK"
SELF:Controls:Add(SELF:oOKButton)
SELF:ResumeLayout()
RETURN
METHOD OKButtonClick(sender AS OBJECT , e AS System.EventArgs) AS VOID
//SELF:Close()
SELF:OKButtonClick2()
// SELF:oTextBox:Text := "Ok"
RETURN
METHOD OKButtonClick2() AS VOID
VAR configuration := ApiConfiguration{"http://localhost:8080/accountright"}
VAR cfService := CompanyFileService{configuration}
VAR comanyFiles := cfService.GetRange()
SELF:oTextBox:Text :="Company Files set"
VAR companyFile := companyFiles.FirstOrDefault({x => Version{x:ProductVersion} >= Version{"2013.3"}})
//VAR credentials := CompanyFileCredentials{"Administrator",""}
//VAR accountService := AccountService{configuration}
//VAR accounts := accountService.GetRange(companyFile,NULL,credentials)
RETURN
END CLASS
#using System.Drawing
#using MYOB.AccountRight.SDK
#using MYOB.AccountRight.SDK.Services
#using MYOB.AccountRight.SDK.Services.GeneralLedger
#using MYOB.AccountRight.SDK.Contracts
//USING MYOB.AccountRight.SDK
//USING MYOB.AccountRight.SDK.Services
//USING MYOB.AccountRight.SDK.Contracts
CLASS BasicForm INHERIT System.Windows.Forms.Form
PROTECT oTextBox AS System.Windows.Forms.TextBox
PROTECT oOKButton AS System.Windows.Forms.Button
// User code starts here (DO NOT remove this line) ##USER##
CONSTRUCTOR()
SUPER()
SELF:InitializeForm()
RETURN
METHOD InitializeForm() AS VOID
// IDE generated code (please DO NOT modify)
SELF:oTextBox := System.Windows.Forms.TextBox{}
SELF:oOKButton := System.Windows.Forms.Button{}
SELF:SuspendLayout()
SELF:ClientSize := System.Drawing.Size{392 , 264}
SELF:Location := System.Drawing.Point{100 , 100}
SELF:Name := "BasicForm"
SELF:Text := "Basic form application"
SELF:oTextBox:Location := System.Drawing.Point{8 , 48}
SELF:oTextBox:Name := "TextBox"
SELF:oTextBox:Size := System.Drawing.Size{341 , 20}
SELF:oTextBox:TabIndex := 1
SELF:Controls:Add(SELF:oTextBox)
SELF:oOKButton:Click += SELF:OKButtonClick
SELF:oOKButton:Location := System.Drawing.Point{280 , 232}
SELF:oOKButton:Name := "OKButton"
SELF:oOKButton:Size := System.Drawing.Size{104 , 24}
SELF:oOKButton:TabIndex := 0
SELF:oOKButton:Text := "&OK"
SELF:Controls:Add(SELF:oOKButton)
SELF:ResumeLayout()
RETURN
METHOD OKButtonClick(sender AS OBJECT , e AS System.EventArgs) AS VOID
//SELF:Close()
SELF:OKButtonClick2()
// SELF:oTextBox:Text := "Ok"
RETURN
METHOD OKButtonClick2() AS VOID
VAR configuration := ApiConfiguration{"http://localhost:8080/accountright"}
VAR cfService := CompanyFileService{configuration}
VAR comanyFiles := cfService.GetRange()
SELF:oTextBox:Text :="Company Files set"
VAR companyFile := companyFiles.FirstOrDefault({x => Version{x:ProductVersion} >= Version{"2013.3"}})
//VAR credentials := CompanyFileCredentials{"Administrator",""}
//VAR accountService := AccountService{configuration}
//VAR accounts := accountService.GetRange(companyFile,NULL,credentials)
RETURN
END CLASS
New to X# and need some direction
Hi Tom,
you need to add a reference to System.Core and a using System.LinQ to solve this error.
Wolfgang
you need to add a reference to System.Core and a using System.LinQ to solve this error.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
New to X# and need some direction
and where do I get them from? How to add them?
New to X# and need some direction
You use the one that is also used in your VS project
Usually the latest version.
Robert
Usually the latest version.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
New to X# and need some direction
Hi Tom,
System.Core is in the GAC - is part of the .NET Framework.
FirstOrDefault() is a extension method that comes from the System.Core assembly and uses the System.LinQ namespace:
msdn.microsoft.com/de-de/library/bb340482(v=vs.110).aspx
Wolfgang
System.Core is in the GAC - is part of the .NET Framework.
FirstOrDefault() is a extension method that comes from the System.Core assembly and uses the System.LinQ namespace:
msdn.microsoft.com/de-de/library/bb340482(v=vs.110).aspx
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
New to X# and need some direction
Hi Tom,
Now you have the Assembly added to your application. In your form.prg you need to now tell it you want to use Linq from the System.Core assembly. You do that by #using System.Linq with your other #using statements.
HTH,
Add Reference (means add a DLL), so here you go to our application Projects tab on the right in XIDE. Right click references, select Add Reference. Then in the window that opens, select the GAC tab. Type System.Core and add from list.tom@dieselworks.com.au wrote: and where do I get them from? How to add them?
Now you have the Assembly added to your application. In your form.prg you need to now tell it you want to use Linq from the System.Core assembly. You do that by #using System.Linq with your other #using statements.
HTH,
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
New to X# and need some direction
Thanks, got this sorted too. I have the test app running (except the last line) and it connects to MYOB, thaks again, really happy. I am not sure if this si a reference issue also?
error XS0120: An object reference is required for the non-static field, method, or property 'ReadableRangeService<Account>.GetRange(CompanyFile, string, ICompanyFileCredentials, string)' 85,19 Form1.prg MYOB_Test1
error XS0120: An object reference is required for the non-static field, method, or property 'ReadableRangeService<Account>.GetRange(CompanyFile, string, ICompanyFileCredentials, string)' 85,19 Form1.prg MYOB_Test1
New to X# and need some direction
Thanks Johan, I have got that sorted, thanks again.
New to X# and need some direction
Thanks Robert, that is sorted, almost there, down to last error