By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

Inherit Control SelectAll() not working

P: n/a
I've modified the standard text box to change the background color on
the "Enter" event and to change the color back to the original value
on "Leave". I've also added a bunch of other methods and properties,
but I don't think that any of them are the issue.

I want to select all of the text when the user clicks on the control.

I have an option to have a borderless box for display, but force a
border during edit. I have to move the box and resize the parameters
to allow for the four pixel dimension change of the border and to keep
the data aligned correctly on the screen. If I use this option, the
SelectAll() command works correctly.

If I use the defaults of having a border in display mode as well as
edit mode, the SelectAll command does not work.
Me.BorderStyle = BorderStyle.Fixed3D
m_EditForceBorder = 0

I've played with moving the Me.Invalidate and a couple of Mickey Mouse
kludges, but not having any luck.

Does anybody have a clue?


Code fragments below.

Imports System.ComponentModel
Imports System.Text
.. . .
<ToolboxBitmap(GetType(SssiTextBox))> _
Public Class SssiTextBox
Inherits TextBox
.. . .
Private Sub SssiTextBox_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Enter
m_EnterValue = Me.Text ' Save entry value
Me.BackColor = m_EnterFocusBackColor
Me.ForeColor = m_EnterFocusForeColor
If m_EditForceBorder <> 0 And Me.BorderStyle =
BorderStyle.None Then
m_EditPreviousBorder = Me.BorderStyle ' Save current
Me.BorderStyle = m_EditForceBorder
Me.Height += 4
Me.Width += 4
Me.Top -= 4
End If
End Sub
.. . .
'---------- Reset colors on leave, unless Mandatory and empty
Private Sub SssiTextBox_Leave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Leave
If Trim(Me.Text).Length = 0 And m_IsMandatory Then
Me.BackColor = m_MandatoryBackColor
Me.ForeColor = m_MandatoryForeColor
Me.BackColor = m_LeaveFocusBackColor
Me.ForeColor = m_LeaveFocusForeColor
End If
If m_EditForceBorder <> 0 And Me.BorderStyle <>
m_EditPreviousBorder Then
Me.BorderStyle = m_EditPreviousBorder
Me.Height -= 4
Me.Width -= 4
Me.Top += 4
End If

If m_EnterValue <> Me.Text Then RaiseEvent
ValueChanged(sender, e)
End Sub
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.