473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inherit Control SelectAll() not working

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?

Thanks
Shane

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
border
Me.BorderStyle = m_EditForceBorder
Me.Height += 4
Me.Width += 4
Me.Top -= 4
Me.Invalidate()
End If
Me.SelectAll()
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
Else
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
Me.Invalidate()
End If

If m_EnterValue <> Me.Text Then RaiseEvent
ValueChanged(sender, e)
End Sub
Nov 21 '05 #1
0 908

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bullshark | last post by:
VSN03:C# Create a C# Windows Form project. Add two TextBox controls. From the Properties of each, add an Enter Event handler. In the generated Enter Event Handlers (textBox1_Enter &...
6
by: Mohammad-Reza | last post by:
I wrote a component using class library wizard. In my component i want to in order to RightToLeft property do some works. I can find out if user set this property to Yes or No, But if He/She set it...
5
by: Mike L | last post by:
This is my first attempt at inheriting a class. I want to inherit textbox class to my derived class ClassNum. ClassNum will override the TextChanged, Leave, KeyPress and Enter methods. So,...
2
by: Jim Haynes | last post by:
I cannot set the tab array for the Rich Text Box control. After I have text in the control, I try the following where rtb is the name of the rich text box control: rtb.selectall() Redim...
10
by: Wayne Wengert | last post by:
In the GotFocus event for several text boxes I include code such as "txtMyTxtBox.SelectAll". When I tab from textbox to textbox the text in the textbox that got focus is selected as expected but if...
4
by: Bill J | last post by:
Hi Everyone, Is there a way of generating a keyboard character event and sending it to a control on a form? For example, if I have a menu item called "Delete", I would like to send a DEL...
3
by: justsome_newbie | last post by:
Sorry for posting another question, but I can't seem to get the hang of ASP.Net. In windows apps if I want to extend a control I would just create a class that inherits from that control and do...
1
by: subbarao.puvvada | last post by:
Hi All, I am working on a Windows application, Which browser control on main form itself develped in .NET 1.1. Recently we have migrated it to .NET 2.0. It's combination of Web pages and .NET...
2
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.