locked
TextBox Caret position on right side RRS feed

  • Question

  • Hi,

    I am trying to set caret position of text box on right side... of textbox.I mean user starts typing, it should  start from right side and characters should me left. Just like as calculator. Is there in built property for textbox or richtextbox? Any solutions.

    Monday, March 21, 2016 8:43 PM

Answers

  • Hi,

    Can you use "TextAlignment" property with TextBox?



    Partial Public Class MainPage
    	Inherits UserControl
    
    	Public Sub New()
    		InitializeComponent()
    	End Sub
    
    	Private Sub RadioButton_Checked(sender As Object, e As RoutedEventArgs) _
    		Handles rbt_From_Left.Checked, rbt_From_Right.Checked
    		Me.textBox.Text = ""
    		If Me.rbt_From_Left.IsChecked Then
    			Me.textBox.TextAlignment = TextAlignment.Left
    			Me.textBox.Text = "TextAlignment.Left"
    		Else
    			Me.textBox.TextAlignment = TextAlignment.Right
    			Me.textBox.Text = "TextAlignment.Right"
    		End If
    	End Sub
    
    	Private Sub btn_Clear_Text_Click(sender As Object, e As RoutedEventArgs) _
    		Handles btn_Clear_Text.Click
    		Me.textBox.Text = ""
    	End Sub
    End Class

    Regards.
    Tuesday, March 22, 2016 3:16 AM