How to Call .Net Dll From TDL

Discussion in 'Tally Developer' started by Azar Shaikh, Sep 1, 2012.

    
  1. Dhanapal Amulraj

    Dhanapal Amulraj New Member


    yes that's in c++ only, i want it in Dotnet. pls send code for dotnet, pls alter it in my project,. pls
     


  2. Suresh

    Suresh New Member


    check the attached code for Compound Interest
     

    Attached Files:



  3. Azar Shaikh

    Azar Shaikh New Member


    For Successful Call of .Net Dll from Tally. Pls go through following Procedure

    ;; TDL Code
    [Collection : Dll Collection]

    Data Source : AxPlugin XML : tallydll.Class1

    1) where tallydll in namespace of dll file, and class1 is dll Class
    2) Dll function name must be "TDLCollection"
    3) Register for Com Interop Must be Checked in Compile option of Dll Project.
    4) Finally & Most Important Dll must be register with windows. Only VC++ Not required to Register.
    5) For Register Dll Follow Following Procedure in Cmd Prompt

    Regasm.exe /unregister ClassLibrary3.dll
    gacutil /u ClassLibrary3
    pause
    Regasm.exe ClassLibrary3.dll /tlb:ClassLibrary3.tbl /codebase
    gacutil /i ClassLibrary3.dll
    pause

    Thanks,
    Azar Shaikh
     


  4. ahmad ejaz

    ahmad ejaz New Member


    Dear all,

    please check my code, why this is not working,


    [#Menu : Gateway of Tally]

    Add : Button : OpenCustomBrowser

    [Button : OpenCustomBrowser]

    Key: Alt+B
    Title: "Open Browser"
    Action: Call:SetTFIValueImage

    [Function : SetTFIValueImage]
    VARIABLE : ImagePath : String
    Variable : ImageFileVar : String
    Variable:ImageFilePath:String
    01 : If : $$IsFieldEdited
    02 : SET : ImageFilePath : "" ;$$Value
    03 : Else
    04 : SET : ImageFilePath : "C:\";$(AppINIConfig, "AppINIConfig").ExportPath
    05 : END IF
    06 : Set : ImageFilePath : $$CallDllFunction:BrowserDLL:TDLCollection:##ImageFilePath:"A"
    07 : IF : Not ImagePath = ""
    08 : SET : ImageFileVar : ##ImagePath
    09 : END IF


    DLL Class

    using Microsoft.VisualBasic;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Forms;
    using System.Threading;
    using System.ComponentModel;
    using System.Configuration;
    using System.IO;
    using System.Web;
    using System.Drawing;
    namespace BrowserDLL
    {


    public class Class1
    {
    public object TDLCollection(string pInputparam, string pInputXML)
    {
    // Invoker Invoker = new BrowserDLL.Invoker();
    string Str = null;
    string filename = null;
    //string selectedPath;
    // FolderBrowserDialog folderBrowserDlg = new FolderBrowserDialog();
    OpenFileDialog openFileDilog = new OpenFileDialog();
    openFileDilog.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
    // saveFileDialog1.d
    DialogResult dgresult = new Invoker(openFileDilog).Invoke();
    if (DialogResult.OK == dgresult)
    {
    SaveFileDialog savefileDilog = new SaveFileDialog();
    savefileDilog.InitialDirectory = @"C:\";
    savefileDilog.FileName = openFileDilog.FileName;

    FileInfo f = new FileInfo(openFileDilog.FileName);
    RichTextBox r = new RichTextBox();

    r.SaveFile(f.FullName);
    // SaveFileDialog dlg = new SaveFileDialog();
    filename = f.FullName;
    // RichTextBox

    // A new folder button will display in FolderBrowserDialog.
    // folderBrowserDlg.ShowNewFolderButton = true;
    //Show FolderBrowserDialog
    // DialogResult dlgResult = folderBrowserDlg.ShowDialog();
    // if (dlgResult.Equals(DialogResult.OK))
    // {
    //Show selected folder path in textbox1.
    //textBox1.Text = folderBrowserDlg.SelectedPath;
    //Browsing start from root folder.
    // Environment.SpecialFolder rootFolder = folderBrowserDlg.RootFolder;
    // }
    }
    // SaveFileDialog dlg = new SaveFileDialog();
    // if (DialogResult.OK == (new Invoker(dlg).Invoke())) { /*handle result*/ ;}
    Str = "<Collection>";
    Str = Str + " <Object>";
    Str = Str + "<Name>" + filename + "</Name>";
    Str = Str + "</Object>";
    Str = Str + "</Collection>";
    return Str;
    }
    }
    }




    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Threading;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Forms;

    namespace BrowserDLL
    {

    public class Invoker
    {
    public CommonDialog InvokeDialog;
    private Thread InvokeThread;
    private DialogResult InvokeResult;

    public Invoker(CommonDialog dialog)
    {
    InvokeDialog = dialog;
    InvokeThread = new Thread(new ThreadStart(InvokeMethod));
    InvokeThread.SetApartmentState(ApartmentState.STA);
    InvokeResult = DialogResult.None;
    }

    public DialogResult Invoke()
    {
    InvokeThread.Start();
    InvokeThread.Join();
    return InvokeResult;
    }

    private void InvokeMethod()
    {
    InvokeResult = InvokeDialog.ShowDialog();

    }
    }
    }


    Thanks
    Ejaz
     

    Attached Files:



  5. Shamsher Singh

    Shamsher Singh New Member


    Dear Mr Suresh.. I am using your TFI.dll for image path. but when i use this tally application close automatically when i select a image file without giving any error. kindly guide me so that i can use your function to call image path in my tally.

    shamsher singh
     
    shubham ahuja likes this.


  6. shubham ahuja

    shubham ahuja New Member


    Dear Shamsher Singh
    U Are doing in right way
     


  7. kalpana

    kalpana New Member


    how to use the dll in tally .where to store the code of vb.net in system and how to connect it to the tally i had created the vb code of File Dialog box but i am not able to connect the dll in tally
     


  8. kalpana

    kalpana New Member


    the vb code Attachment

    Please Help me how to use the same.
     

    Attached Files:



  9. Dharmendra Rane

    Dharmendra Rane New Member


    how to integrate input font software with tally like coral keyboard manager
     


  10. kalpana

    kalpana New Member


    Dear Admin,
    help for the same how to use .net dll file in tally
     


  11. kalpana

    kalpana New Member


    dear admin help for the same how to use .net dll file in tally
     



  12. Yes
    can u help me sir
     


  13. Sambanthan

    Sambanthan New Member


    Yes Sir i need Like this DLL File, can u help me. my no: 7338870156
     


Share This Page