c# - Unexpected text (System.Int32[]) -


i trying make code computes hold time , press/release times of keys entered through keyboard.

hold time = keyup(i) - keydown(i+1) release_press time = keydown(i+1) - keyup(i) press_press time = keydown(i+1) - keydown(i) release_release time = keyup(i+1) - keyup(i) 

and code neither error nor warnings ...but when run (system.int32[]) in text boxes hold , press/release times should exhibited. don't know why i'm getting error or error is.

form1.cs

    using system;     using system.collections.generic;     using system.componentmodel;     using system.data;     using system.drawing;     using system.linq;     using system.text;     using system.windows.forms;     using domainnn;     using sessionnn;       namespace thelatestks     {          public partial class form1 : form {     brokerrr b = new brokerrr();     public form1()     {         initializecomponent();     }      int = 0;     private void timer1_tick(object sender, eventargs e)     {         i++;     }      int[] a=new int[25];     int[] b=new int[25];     int[] c=new int[25];     int[] d=new int[25];     int[] m=new int[25];     int[] n=new int[25];     int[] o=new int[25];     int[] p=new int[25];      private void textbox2_keydown(object sender, keyeventargs e)     {         timer1.enabled = true;          (int = 0; < textbox2.textlength; a++)         {             timer2.enabled = true;             m[a] = k;             if (a >= 1)             {                 o[a] = k;             }         }     }      int j = 0;     int s = 0;     float ave = 0;     private void button1_click(object sender, eventargs e)          {             timer1.enabled = false;             textbox5.text = i.tostring() + " ms";             s = s + i;             personnn p = new personnn();             p.username = textbox1.text;             p.password = textbox2.text;             p.totaltyping = label5.text;             p.keyduration = textbox3.text;              textbox4.text += textbox2.text + environment.newline;              if (j >= 2)             {                 ave = s / 3;                 textbox6.text = ave.tostring() + " ms";             }              p.meanoftotal = textbox6.text;             p.udlatency1 = textbox8.text;             p.ddlatency1 = textbox9.text;             p.uulatency1 = textbox10.text;              b.insert(p);              textbox1.text = " ";             textbox2.text = " ";             textbox3.text = " ";             textbox8.text = " ";             textbox9.text = " ";             textbox10.text = " ";              = 0;              j++;          }      private void textbox1_keydown(object sender, keyeventargs e)     {          if ((e.keyvalue < 65 || e.keyvalue > 122) && (e.keyvalue != 32) && (e.keyvalue != 8))         {             label7.text = "only letters allowed";           }          if (e.keyvalue ==  8)         {             label7.text = " ";         }     }      private void textbox2_keyup(object sender, keyeventargs e)     {         (int = 0; < textbox2.textlength; a++)         {             timer2.enabled = true;             n[a] = k;             if (a >= 1)             {                 p[a] = k;             }          }          (int ii = 0; ii <textbox2.textlength; ii++)         {          a[ii] = n[ii] - m[ii];// key duration         }          (int iii = 0; iii < textbox2.textlength-1; iii++)         {          b[iii] = o[iii] - n[iii];//ud latency          c[iii] = o[iii] - m[iii];//ddlatency          d[iii] = p[iii] - n[iii];//uu latency         }          textbox3.text = a.tostring();// key duration          textbox8.text = b.tostring();// ud latency          textbox9.text = c.tostring();// dd latency          textbox10.text = d.tostring();// uu latency      }      int k = 0;     private void timer2_tick(object sender, eventargs e)     {         k++;     }      private void form1_load(object sender, eventargs e)     {      }      private void label8_click(object sender, eventargs e)     {      }  }     } 

personnn.cs

    using system;     using system.collections.generic;     using system.linq;     using system.text;      namespace domainnn     { public class personnn {     int id;      public int id     {         { return id; }         set { id = value; }     }     string username;      public string username     {         { return username; }         set { username = value; }     }     string password;      public string password     {         { return password; }         set { password = value; }     }      string totaltyping;      public string totaltyping     {         { return totaltyping; }         set { totaltyping = value; }     }      string meanoftotal;      public string meanoftotal     {         { return meanoftotal; }         set { meanoftotal = value; }     }      string keyduration;      public string keyduration     {         { return keyduration; }         set { keyduration = value; }     }      string udlatency;      public string udlatency1     {         { return udlatency; }         set { udlatency = value; }     }     string ddlatency;      public string ddlatency1     {         { return ddlatency; }         set { ddlatency = value; }     }     string uulatency;      public string uulatency1     {         { return uulatency; }         set { uulatency = value; }     } }     } 

brokerrr.cs

using system; using system.collections.generic; using system.linq; using system.text; using system.data; using system.data.oledb; using domainnn;  namespace sessionnn {     public class brokerrr     {         oledbconnection connection;         oledbcommand command;          private void connectto()         {             connection = new oledbconnection(@"provider=microsoft.ace.oledb.12.0;data source=c:\users\s.m.a.s\documents\visual studio 2010\projects\thelatestks\databaseee.accdb");             command = connection.createcommand();          }         public brokerrr()         {             connectto();         }          public void insert(personnn p)         {             try             {                 command.commandtext = "insert table1 ([username], [password], totaltyping, meanoftotal, keyduration, udlatency, ddlatency ,uulatency) values('" + p.username + "', '" + p.password + "', '" + p.totaltyping + "', '"+p.meanoftotal+"', '"+p.keyduration+"', '"+p.udlatency1+"', '"+p.ddlatency1+"', '"+p.uulatency1+"')";                 command.commandtype = commandtype.text;                 connection.open();                  command.executenonquery();             }             catch (exception)             {                  throw;             }                         {                 if (connection != null)                 {                     connection.close();                 }             }         }     } } 

the problem lines following:

textbox3.text = a.tostring();// key duration 

the tostring() method doesn't make string containing numbers. tells type is. default tostring behavior.

ints display number because have overridden tostring method.

you might want

a[i].tostring(); 

or might want make sort of aggregate string of array, in case can write function or that.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -