A
AdamD
So the following code is what im having issues with. Everything is fine and
dandy till the application hits the modTask.Text1
MSProject.Task modTask = applicationObject.ActiveProject.Tasks[this.taskId];
modTask.Name = txtTaskName.Text; //Just fine
//Needs to be a short
modTask.Priority = Convert.ToInt16(nudPriority.Value); //Just fine -
//the priority is a short and value of nudPriority is a decimal
modTask.Start = dtpStartTime.Value; //Just fine - value is DateTime, Start
is just a type object
modTask.Finish = dtpEndTime.Value; //Just fine - value is DateTime, Finish
is just a type object
//Text objects that throw error
modTask.Text1 = txtLabel.Text; //Throws the COMException Argument value not
valid
modTask.Text2 = txtEqiupment.Text; //So will this one
modTask.Text3 = txtOutageType.Text; //So will this one
//Flags that throw the error
modTask.Flag1 = chkbxEHVSUBSLINES.Checked; //So will this one
modTask.Flag2 = chkbxGenerationFlag.Checked; //So will this one
modTask.Flag3 = chkbxInterconnectionFlag.Checked; //So will this one
modTask.Flag4 = chkbxSubTransmission.Checked; //So will this one
modTask.Flag5 = chkbxSubstationFlag.Checked; //So will this one
//modTask.Text1 - 3 are all type Strings and Flag1 - 5 are type object
I have tried the following:
Using temp strings before setting the text1-3 as to correctly type
Casting the type while trying to define (ie:
(Boolean)chkbxSubstationFlag.Checked; - Doesnt work)
Using the SetField Function of the Task Interface, throws exact same error,
code below
//modTask.SetField(Microsoft.Office.Interop.MSProject.PjField.pjTaskText1,
stringToSend);
I have searched for this issue and cant seem to find anything related.
Please help!
Adam
dandy till the application hits the modTask.Text1
MSProject.Task modTask = applicationObject.ActiveProject.Tasks[this.taskId];
modTask.Name = txtTaskName.Text; //Just fine
//Needs to be a short
modTask.Priority = Convert.ToInt16(nudPriority.Value); //Just fine -
//the priority is a short and value of nudPriority is a decimal
modTask.Start = dtpStartTime.Value; //Just fine - value is DateTime, Start
is just a type object
modTask.Finish = dtpEndTime.Value; //Just fine - value is DateTime, Finish
is just a type object
//Text objects that throw error
modTask.Text1 = txtLabel.Text; //Throws the COMException Argument value not
valid
modTask.Text2 = txtEqiupment.Text; //So will this one
modTask.Text3 = txtOutageType.Text; //So will this one
//Flags that throw the error
modTask.Flag1 = chkbxEHVSUBSLINES.Checked; //So will this one
modTask.Flag2 = chkbxGenerationFlag.Checked; //So will this one
modTask.Flag3 = chkbxInterconnectionFlag.Checked; //So will this one
modTask.Flag4 = chkbxSubTransmission.Checked; //So will this one
modTask.Flag5 = chkbxSubstationFlag.Checked; //So will this one
//modTask.Text1 - 3 are all type Strings and Flag1 - 5 are type object
I have tried the following:
Using temp strings before setting the text1-3 as to correctly type
Casting the type while trying to define (ie:
(Boolean)chkbxSubstationFlag.Checked; - Doesnt work)
Using the SetField Function of the Task Interface, throws exact same error,
code below
//modTask.SetField(Microsoft.Office.Interop.MSProject.PjField.pjTaskText1,
stringToSend);
I have searched for this issue and cant seem to find anything related.
Please help!
Adam