Beispiel #1
0
        /// <summary>
        /// Inserts the supplied string into the existing textBox text
        /// </summary>
        /// <param name="controlHandle">The control to be worked with</param>
        /// <param name="newText">Text to append to TextBox value</param>
        /// <param name="insertIndex">Zero based index of string to insert text into</param>
        /// <exception cref="ProdOperationException">Examine inner exception</exception>
        public static void InsertText(IntPtr controlHandle, string newText, int insertIndex)
        {
            if (GetReadOnly(controlHandle))
            {
                throw new ProdOperationException("TextBox is Read Only");
            }

            try
            {
                NativeTextProds.InsertTextNative(controlHandle, newText, insertIndex);
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
 private static void NativeInsertText(BaseProdControl control, string newText, int index)
 {
     NativeTextProds.InsertTextNative((IntPtr)control.UIAElement.Current.NativeWindowHandle, newText, index);
 }