[ask] simple question about textbox
dear guys
i have a question
i have a code like this
Code:
dim x as as string=""
private sub form1_load......
x &="bla bla bla......."
textbox1.text = x
end sub
the question is
in the text box when it's loaded there's a selection all the text..... HOw to remove the selection....and how to hide the cursor.....
thx
Re: [ask] simple question about textbox
textbox1.text = x
TextBox1.SelectionStart = 0
Re: [ask] simple question about textbox
Quote:
Originally Posted by Deepak Sakpal
textbox1.text = x
TextBox1.SelectionStart = 0
it works...thx
Re: [ask] simple question about textbox
another question...
how to make the cursor hide form the textbox, but not from the form....????
and how to make the textbox just can read but there's nothing can edit it....??
thx
Re: [ask] simple question about textbox
Re: [ask] simple question about textbox
Quote:
Originally Posted by Deepak Sakpal
TextBox1.ReadOnly=True
i know about it...
but i want to make, we can't make a selection to the text.
and then make the cursor hide in the text box...but not in the form.
if i make cursor.hide...it hides all
thx
Re: [ask] simple question about textbox
Well this is a dodgy example which will answer that question (until someone posts a nicer method of not allowing a textbox selection to be performed):
Code:
Private Sub TextBox1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove
Cursor = Cursors.No
Me.TextBox1.SelectionStart = 0
Me.TextBox1.SelectionLength = 1
End Sub
Private Sub TextBox1_MouseLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TextBox1.MouseLeave
Cursor = Cursors.Default
End Sub
Re: [ask] simple question about textbox
Re: [ask] simple question about textbox
Why not simply use a label with a white background?
Re: [ask] simple question about textbox
Code:
Private Sub TextBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.MouseEnter
Windows.Forms.Cursor.Hide()
End Sub
Private Sub TextBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.MouseLeave
Windows.Forms.Cursor.Show()
End Sub
Pure. Sweet. Simple. Just the way I like it. :D
D