title: web service and application form in c#
body: <p>I am using <code>webservice</code> and windows application in visual basic i have a code in web service that passes data to web application what i want to do is to display the data to <code>textbox</code> in windows application.</p>
  
  <p>this is my code for web service</p>
  
  <pre><code>   [WebMethod]
     public string searchCom(string compCode)
     {
          string msg = string.Empty;
          SqlConnection conn = new SqlConnection("Data Source=LOCALPC\\SQLEXPRESS1; Initial Catalog=Company;Integrated Security=True;");
          DataTable dt = new DataTable();
          SqlCommand cmd = new SqlCommand("selectPress", conn);
          SqlDataAdapter da = new SqlDataAdapter(cmd);
          cmd.Parameters.Add("@item", SqlDbType.VarChar).Value = compCode;
          cmd.CommandType = CommandType.StoredProcedure;
          da.Fill(dt);
          if (dt.Rows.Count &gt; 0)
          {
              foreach (DataRow row in dt.Rows)
              {
                  string[] data = new string[3];
                  textBox2.Text = Convert.ToString(row["CompanyName"]);
                  textBox3.text = Convert.ToDecimal(row["balance"]);
                  textBox4.text = Convert.ToDecimal(row["maintBalance"]);
                  textBox2.ReadOnly = true;
                  textBox3.ReadOnly = true;
                  textBox4.ReadOnly = true;
                  button1.Visible = false;
                  Back.Visible = true;
              }
         }
         return msg;
     }
  </code></pre>
  
  <p>And here is the code on button click inside my windows application(VB)</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e) 
  { 
       string msg = string.Empty; 
       msg = service.searchCom(textBox1.Text); 
  }
  </code></pre>
  
  <p>Error is appearing in that <code>textbox</code>.</p>