title: C# populate a textbox from listbox taken from JSON file data
body: <p>I have a JSON file from my local folder:</p>
  <p><strong>Shawn Milke.json</strong></p>
  <pre><code>{
    &quot;FirstName&quot;: &quot;Shawn&quot;,
    &quot;LastName&quot;: &quot;Milke&quot;,
    &quot;Email&quot;: &quot;shawn.milke@alesana.com&quot;,
    &quot;TeamName&quot;: &quot;Shawn Milke&quot;,
    &quot;Password&quot;: &quot;shawn123&quot;,
    &quot;IsActive&quot;: &quot;Yes&quot;,
    &quot;UserId&quot;: 100
  }
  </code></pre>
  <p>Here's the code in populating the listbox from JSON file:</p>
  <pre><code>private void ShowListViewNew()
  {
      List&lt;UserAccount&gt; userAccounts = new List&lt;UserAccount&gt;();
  
      var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
      var outputDir = Path.Combine(dir, &quot;Output&quot;);
  
      foreach (var file in Directory.GetFiles(outputDir, &quot;*.json&quot;))
      {
          var text = File.ReadAllText(file);
          var model = JsonConvert.DeserializeObject&lt;UserAccount&gt;(text);
          userAccounts.Add(model);
      }
      listBoxUsers.DataSource = userAccounts;
  }
  </code></pre>
  <p>And here's also my code in populating the textboxes from the listbox selected:</p>
  <pre><code>private void listBoxUsers_SelectedIndexChanged(object sender, EventArgs e)
  {
      var model = (UserAccount)listBoxUsers.SelectedItem;
      txtFirstName.Text = model.FirstName;
      txtLastName.Text = model.LastName;
      txtEmail.Text = model.Email;
      txtTeamName.Text = model.TeamName;
      txtPassword.Text = model.Password;
      if (model.IsActive== &quot;Yes&quot;)
      {
          chkIsActive.Checked = true;
      }
      else
      {
          chkIsActive.Checked = false;
      }
      txtUserId.Text = model.UserId;
  }
  </code></pre>
  <p>Now my main problem is I want to know how I can convert it from int to string in this line of code</p>
  <pre><code>txtUserId.Text = model.UserId;
  </code></pre>
  <p>Because I usually do it this way:</p>
  <pre><code>UserId = int.Parse(txtUserId.Text)
  </code></pre>
  <p>Since now it's changed, I'm not sure on how I can convert it from int to string. Can someone help? Thanks!</p>