/// <summary> /// Sets the value of a field to a string. /// </summary> /// <param name="field">Specifies the field to set.</param> /// <param name="value">new value of the field</param> /// <exception cref="ArgumentOutOfRangeException">The field is less than 0 or greater than the /// number of fields in the Record.</exception> /// <remarks><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msirecordsetstring.asp">MsiRecordSetString</a> /// </p></remarks> public void SetString(int field, string value) { this.CheckRange(field); if (value == null) { value = String.Empty; } uint ret = RemotableNativeMethods.MsiRecordSetString((int)this.Handle, (uint)field, value); if (ret != 0) { throw InstallerException.ExceptionFromReturnCode(ret); } // If we set the FormatString manually, then it should be valid again if (field == 0) { this.IsFormatStringInvalid = false; } }