From: eliza on 11 May 2010 05:30 Its check each character?s ASCII value entered into the textbox, so when the enter key is pressed its also check the ASCII value and then it avoid to insert the carriage return value to the textbox. So we can avoid to insert Carriage Return into the textbox having ? Multiline? TextMode property or in TextArea control. <asp:TextBox ID="txtComments" Height="150" Columns="200" TextMode="multiline" MaxLength="4000" runat="server" onkeydown = "return (event.keyCode!=13);" /> Note: ASCII value for Enter Key is 13. http://www.mindfiresolutions.com/Restrict-to-insert-carriage-return-into-Textbox-control-535.php matchorno wrote: Carriage Return Symbol Text Field Word Form VBA Problem inside Tab 03-Mar-10 I am trying to insert some text into a protected Word text field with carriage returns for new lines via VBA code. For example, I would like to enter something like the following into a text field called Text1: Test Line 1 Test Line 2 Test Line 3 So my code is: ActiveDocument.FormFields("Text1").Result = "Test Line 1" & Chr(13) & "Test Line 2" & Chr(13) & "Test Line 3" The text field is located inside of a table cell. The problem is that it is inserting the box symbol for chr(13) instead of a new line. So it looks like this: Test Line 1[]Test Line 2[]Test Line 3. I have tried playing around with different carriage returns such as vbcrlf and chr(10) as well as combinations such as chr(13) & chr(10), but the same thing happens. The weird thing is that if the text field is NOT located inside a table, it works just fine. But if the text field is inside of a table, it gives me the squares. I really need to keep it inside a table, as that is how the form is laid out. Also weird is that I have a second field (also inside a table) called Text2 which is a calculated field, which basically mirrors the Text1 field. While Text1 has the square symbol, the calculated field does not...and looks fine even though it is part of a table too. I tried playing around with different table settings like wrap text, setting a row size, not setting a row size, etc. to no avail. I cannot seem to find the answer on any existing forums. Any help is greatly appreciated as I have been at this for an entire day now. Thanks!! Previous Posts In This Thread: On Wednesday, March 03, 2010 10:35 AM matchorno wrote: Carriage Return Symbol Text Field Word Form VBA Problem inside Tab I am trying to insert some text into a protected Word text field with carriage returns for new lines via VBA code. For example, I would like to enter something like the following into a text field called Text1: Test Line 1 Test Line 2 Test Line 3 So my code is: ActiveDocument.FormFields("Text1").Result = "Test Line 1" & Chr(13) & "Test Line 2" & Chr(13) & "Test Line 3" The text field is located inside of a table cell. The problem is that it is inserting the box symbol for chr(13) instead of a new line. So it looks like this: Test Line 1[]Test Line 2[]Test Line 3. I have tried playing around with different carriage returns such as vbcrlf and chr(10) as well as combinations such as chr(13) & chr(10), but the same thing happens. The weird thing is that if the text field is NOT located inside a table, it works just fine. But if the text field is inside of a table, it gives me the squares. I really need to keep it inside a table, as that is how the form is laid out. Also weird is that I have a second field (also inside a table) called Text2 which is a calculated field, which basically mirrors the Text1 field. While Text1 has the square symbol, the calculated field does not...and looks fine even though it is part of a table too. I tried playing around with different table settings like wrap text, setting a row size, not setting a row size, etc. to no avail. I cannot seem to find the answer on any existing forums. Any help is greatly appreciated as I have been at this for an entire day now. Thanks!! On Wednesday, March 03, 2010 2:20 PM matchorno wrote: Nevermind. I figured out a workaround. Nevermind. I figured out a workaround. Using the following code works fine: Instead of using: ActiveDocument.FormFields("Text1").Result = "Test Line 1" & Chr(13) & "Test Line 2" & Chr(13) & "Test Line 3 Use: Selection.GoTo What:=wdGoToBookmark, Name:="Text1" Selection.Text = "Test Line 1" & Chr(13) & "Test Line 2" & Chr(13) & "Test Line 3" Submitted via EggHeadCafe - Software Developer Portal of Choice Excel 2007 Filter Tool http://www.eggheadcafe.com/tutorials/aspnet/ae703d26-58da-423a-a2cb-1f3a46fbea8f/excel-2007-filter-tool.aspx
|
Pages: 1 Prev: Document template for email - standard subject Next: Live Preview - Word 2007 |