|
-
Apr 16th, 2007, 07:08 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Textbox TextAlign and SelectAll in CompactFramework
Still adapting to .NET, it really is a different animal than VB6.
I have found that there are some slight differences in the TextBox object in the Compact Framework.
First, the TextAlign property can be used to set the textbox's alignment to HorizontalAlignment.Center, for example. In the CF 2.0, only HorizontalAlignment.Left is available on Multiline = True. MSDN details this information, "Platform Note: In Pocket PC-based applications, a single-line text box supports only left alignment. A multiline text box can be aligned on the left, right, or center. "
Is there any problem using a single line textbox with Multiline = true so that the pther alignments can be used, for example a currency field?
Second, when the Shown event fires, you can use the following code to select all text in a textbox control.
Code:
TextBox1.Focus()
TextBox1.SelectAll()
In the CF 2.0, this same code cannot be used in the Shown event because it is not supported, so must use the Activated event. Also, for the code to work properly I must set the TabIndex = 0. Otherwise the form loads and becomes Activated without selecting the text in the textbox.
What would be the proper code to select all text in a textbox control after a form has been loaded?
Last edited by easymoney; Apr 16th, 2007 at 07:19 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|