title: C# Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox' and not all code paths return a value
body: <p>I have to calculate 3 variables which the method is being called from another class. But before I print the result, I have to convert the int result into predetermined letter of value. But my code isn't work. I have this error on the code:</p>
  
  <blockquote>
    <p>CS0029  C# Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox'
    CS0161  C# '': not all code paths return a value</p>
  </blockquote>
  
  <p>I've tried to convert function into string, but the code still won't work.</p>
  
  <p>This is the class:</p>
  
  <pre><code> class Nilai
      {
          public int Calculate(int tugas, int uts, int uas)
          {
              int final = (tugas + uts + uas) / 3;
              return final;
          }
      }
  </code></pre>
  
  <p>This is the <code>Form1</code>:</p>
  
  <pre><code>namespace IP_Calculator
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
  
              nilaiHuruf1 = nilaiHuruf();
          }
  
         public string nilaiHuruf()
          {
              int a = Convert.ToInt32(tugas1.Text);
              int b = Convert.ToInt32(uts1.Text);
              int c = Convert.ToInt32(uas1.Text);
              Nilai vnilai = new Nilai();
              int hasil = vnilai.Calculate(a, b, c);
              if (hasil &gt;= 85)
              {
                  nilaiHuruf1.Text = "A";
                  return nilaiHuruf1.ToString();
              }
              else if (hasil &gt;= 80)
              {
                  nilaiHuruf1.Text = "A-";
                  return nilaiHuruf1.ToString();
              }
              else if (hasil &gt;= 75)
              {
                  nilaiHuruf1.Text = "B+";
                  return nilaiHuruf1.ToString();
              }
              else if (hasil &gt;= 70)
              {
                  nilaiHuruf1.Text = "B";
                  return nilaiHuruf1.ToString();
              }
  
              else if (hasil &gt;= 65)
              {
                  nilaiHuruf1.Text = "B-";
                  return nilaiHuruf1.ToString();
              }
  
              else if (hasil &gt;= 60)
              {
                  nilaiHuruf1.Text = "C+";
                  return nilaiHuruf1.ToString();
              }
  
              else if (hasil &gt;= 55)
              {
                  nilaiHuruf1.Text = "C";
                  return nilaiHuruf1.ToString();
              }
              else if (hasil &gt;= 45)
              {
                  nilaiHuruf1.Text = "D";
                  return nilaiHuruf1.ToString();
              }
              else if (hasil &lt;= 44.99)
              {
                  nilaiHuruf1.Text = "E";
                  return nilaiHuruf1.ToString();
              }
          }
              }
  
          }
  </code></pre>
  
  <p>I expect if I call the method from the Class Nilai to the function nilaiHuruf, then I will get the conversion into letter value. After that, I can call the nilaiHuruf function into the button.</p>