Accounting-Companion / TallyConnector

You can use Tally Connector to Connect your desktop/Mobile Applications with Tally seamlessly.
48 stars 29 forks source link

C# code issue - DLL reference #2

Closed sanketgroup closed 3 years ago

sanketgroup commented 3 years ago

Hello, I did the following code in C#, just to start with basics. I get errors as shown in screenshots. Pls help. Thanks image

saivineeth100 commented 3 years ago

mistakes from your side

1 mistake from documentation

So your code should be

        public Tally Ctally = new Tally();
        private void Form2_Load(object sender, EventArgs e)
        {
            TallyInit();
        }
        private async void TallyInit()
        {
            string VoucherNumber = "vchnum";
            string Date = "somedate";
            string VoucherMasterID = "vchmasterid";
            Voucher voucher = await Ctally.GetVoucherByVoucherNumber(VoucherNumber, Date);
            //If you have master id of voucher
            Voucher voucher2 = await Ctally.GetVoucherByMasterID(VoucherMasterID);
        }

You need to add break point at voucher and voucher2 to see data image

sanketgroup commented 3 years ago

I might be wrong given less experience with C#. Following what I did, but not working.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TallyConnector;
using TallyConnector.Models;

namespace tallytest
{
    public Tally Ctally = new Tally();
    private void Form2_Load(object sender, EventArgs e)
    {
        TallyInit();
    }
    private async void TallyInit()
    {
        string VoucherNumber = "vchnum";
        string Date = "somedate";
        string VoucherMasterID = "vchmasterid";
        Voucher voucher = await Ctally.GetVoucherByVoucherNumber("JV263", "20210331");
        //If you have master id of voucher
        Voucher voucher2 = await Ctally.GetVoucherByMasterID(VoucherMasterID);
    }

image

saivineeth100 commented 3 years ago

You removed class definition

namespace tallytest
{
   Public partial class Form2:Form
  {
     //Code goes here
   }
}
sanketgroup commented 3 years ago

Getting following issue

capture2

saivineeth100 commented 3 years ago

Try this Replace

using System.Windows.Forms;

with

using WF = System.Windows.Forms;

Form with WF.Form

sanketgroup commented 3 years ago

Getting error in program.cs when clicking on button. image

image

sanketgroup commented 3 years ago

image

saivineeth100 commented 3 years ago

Compare your previous code and this code - You will know you Removed


public Form1(){
InitializeComponent();
}
saivineeth100 commented 3 years ago

@sanketgroup I added WPF example to the repo you can check now

sanketgroup commented 3 years ago

Compare your previous code and this code - You will know you Removed

public Form1(){
InitializeComponent();
}

It gives error when I keep that .. Screenshot attached in previous post. Posting again.

===================

image

saivineeth100 commented 3 years ago

Create a new windows forms application and try

sanketgroup commented 3 years ago

Create a new windows forms application and try

I did that way, but the same error.

Also Could you please add an example project for .Net framework? ( i see only .Net core)

saivineeth100 commented 3 years ago

example works for both(c#)

Also added WinForms example check

sanketgroup commented 3 years ago

while building your example, getting this error may be due to .Net5.0 core, which I do not have.

============= image

saivineeth100 commented 3 years ago

You can copy code in form1 class and paste in your Form1 class It works fine Provided add Change button click event of your button to button1_Click in example code

sanketgroup commented 3 years ago

pls see attached video. (this is not Net.Core) (This is on .Net Framework)

https://user-images.githubusercontent.com/6008084/123231811-2a339900-d4f6-11eb-8a2c-b20dc8466747.mp4

saivineeth100 commented 3 years ago

There were some unmerged commits in .net Framework Now fetch latest repo from github and build it will work

sanketgroup commented 3 years ago
  1. I downloaded your new repo and built new DLL, copied that new dll to my existing project. But the error is same as shown in video.
  2. I downloaded your new repo, opened TallyConnector-NetFramework.sln. Built sucessfully. But when I open "WinFormsExample.sln" and try to build I get following error.

    image

saivineeth100 commented 3 years ago

Send me your anydesk ID at contact@saivineeth.com