Object reference not set to an instance of an object. exception at string assignment
<p>This is  my code to generate an autogenerating jobcode and fill it in a text box</p>

<pre><code>          public void newjobecodenoget(){
         String jobcodeno = null;
        OleDbConnection oleDbConnection1 = new System.Data.OleDb.OleDbConnection(connString);
        oleDbConnection1.Open();


        String query = "SELECT TOP 1 jobpk FROM jobcodemastertable ORDER BY jobpk DESC";
        OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString);


        DataSet ds = new DataSet();

        dAdapter.Fill(ds, "tbljobrdataview");
        Int32  S = int.Parse(ds.Tables[0].Rows[0][0].ToString());
        S++;

         jobcodeno = "NFT" + S.ToString();
         MessageBox.Show( jobcodeno);
         txtjobcode.Text = "NFT" + S.ToString();

    }
</code></pre>

<p>but Iam getting exception at the last line ie  txtjobcode.Text = "NFT" + S.ToString();
Object reference not set to an instance of an object.
all other things are fine and jobcode is generated and shown in message box
can anyone help pls</p>

<p>my txtjobecode was declared as</p>

<pre><code>private void InitializeComponent()
        {
         this.txtjobcode = new System.Windows.Forms.TextBox();  
// 
            // txtjobcode
            // 
            this.txtjobcode.Location = new System.Drawing.Point(98, 23);
            this.txtjobcode.Name = "txtjobcode";
            this.txtjobcode.Size = new System.Drawing.Size(91, 20);
            this.txtjobcode.TabIndex = 0;
            //

} 
</code></pre>
