Reading value that exists in UD key

I have a UD form with the 5 normal keys that come with it which are associated with UD record. How can I read a value in one of the key boxes into a string? I am getting a compiler error when I try to compile the following.
ud29DS.ud29[0].Key1 = txtKeyField.Text;

I want to read txtKeyField into a string if that is possible.

Hi Joel,

Are you trying to read the key1 value from an existing UD29 record or create a new UD29 row and set the key1 value?
Looks like you are trying to assign a UI field to Key1. Please provide some more context.
Also, what is the full error message?

I did this a different way. Thank you for reading this and responding.