C# SetField enums

  • Thread starter MacKenzie Mickelsen
  • Start date
M

MacKenzie Mickelsen

Hey All

I am having a great deal of difficulty in setting propties that are Enum's
using the SetField method. I consistently get an exception that states "There
is Problem with the Entry" and an error code of -2146827187. What I am
doing is like this

Task.SetField(enum.Property, Convert.ToString(Convert.ToInt32(PjEnum)));

which craps. The Convert it to a string because that is what the SetField
method requires. I also Convert the val to an Int before then to take it from
the enum to a value that can be set. I have also tried using a string that is
the enum but that didnt work either. Any help would be most appreciated.

Thanks
Kenzie
 
A

Adam Behrle

Hi Kenzie,

I'm not sure what you are trying to do with the second enum. That
should be the value of the field. Your code should look something like
this:

targetTask.SetField(PjField.pjTaskWork, "8h");

Hope that helps,

Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top