title: Display array Data Excel Dna
body: <p>I am having trouble displaying data using Excel-Dna with C#. I have a function which takes in data and processes it to make a table, so I wrote a test function just to display the data, and I am unable to get a value out. The error is #VALUE.</p>
  
  <pre><code>public class Functions : IExcelAddIn
  {
      public static String Username { get; set; }
      public static String Password { get; set; }
      public static Random rnd = new Random();
  
      public void AutoOpen()
      {
          ExcelAsyncUtil.Initialize();
      }
  
      public void AutoClose()
      {
          ExcelAsyncUtil.Uninitialize();
      }
  
      [ExcelFunction(Description="My first Excel-DNA function")]
      public static string MyFirstFunction(string name)
      {
          return "Hello, " + name + ".";
      }
  
      public static string ShowCurrentUser()
      {
          return (String.IsNullOrWhiteSpace(Username)) ? "Noone is logged in." : Username;
      }
      public static string LogIn(string user, string password)
      {
          const string connectionString = "server=localhost;userid={0};password={1};";
          MySqlConnection connection = new MySqlConnection(String.Format(connectionString, user, password));
          string output = "";
          try
          {
              connection.Open();
              Username = user;
              Password = password;
              output = "Successfully logged in!";
          }
          catch (Exception e)
          {
              output = "Errors: " + e.ToString();
          }
          finally
          {
              connection.Close();
          }
  
          return output;
      }
      public static object QMRTable(int SynNum, int YoA, int qtr, int TabNum)
      {
          object[,] response = new object[16, 3];
  
          for (int r = 0; r &lt; response.GetLength(0); r++)
              for (int c = 0; c &lt; response.GetLength(1); c++)
                  response[r, c] = String.Format("Synd: {0}, YoA: {1}, Qtr: {2}, ({3},{4})", SynNum, YoA, qtr, r, c);
  
          return XlCall.Excel(XlCall.xlUDF, "Resize", response);
          //return response;
      }
      public static object QMRItem(int SynNum, int YoA, string qtr, string item)
      {
          return (rnd.NextDouble() * (100.0 - 0.0) + 0.0) + " GBP (M)";
      }
  }
  </code></pre>
  
  <p>It seems what I am not understanding is how to set up my add in to have these methods be called correctly.</p>