title: Programmatically setting field value for sharepoint listitem
body: <p>I'm trying to simply add a simple text or hyperlink field to a list item in sharepoint 2007.</p>
  
  <p>I can add the field no problem:</p>
  
  <pre><code>list.Fields.Add("MyField",SPFieldType.Text, false);
  </code></pre>
  
  <p>And it shows up fine on my list items.
  However no matter which way I try, I can't programmatically set a value for the field. I tried:</p>
  
  <pre><code>list.items[0]["MyField"] = "text";
  </code></pre>
  
  <p>and I tried loading into a field:</p>
  
  <pre><code>SPField field = list.items[0].Fields["MyField"];
  </code></pre>
  
  <p>and setting it there, and setting the default value and updating, but nothing what so ever happens.</p>
  
  <p>I always finish my code blocks with list.update(); or if I'm operating on the item itself item.update(); so I'm not at least missing that. Can anyone tell me what I'm doing wrong?</p>
  
  <p>Thanks</p>