Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: executing linux commands remotely using ssh and storing command output locally using vb script Pin
superselector19-Sep-13 21:39
superselector19-Sep-13 21:39 
QuestionRetrieving Custom Attributes on Enumeration Members Pin
Dominick Marciano13-Sep-13 18:01
professionalDominick Marciano13-Sep-13 18:01 
AnswerRe: Retrieving Custom Attributes on Enumeration Members Pin
Eddy Vluggen15-Sep-13 2:18
professionalEddy Vluggen15-Sep-13 2:18 
QuestionVideo overlay and Full Screen Vb 6 Pin
Member 1027147112-Sep-13 23:14
Member 1027147112-Sep-13 23:14 
AnswerRe: Video overlay and Full Screen Vb 6 Pin
Eddy Vluggen15-Sep-13 2:27
professionalEddy Vluggen15-Sep-13 2:27 
QuestionTextbox keeps losing focus Pin
CJotaO12-Sep-13 3:32
CJotaO12-Sep-13 3:32 
AnswerRe: Textbox keeps losing focus Pin
Dave Kreskowiak12-Sep-13 4:11
mveDave Kreskowiak12-Sep-13 4:11 
AnswerRe: Textbox keeps losing focus Pin
TnTinMn12-Sep-13 4:34
TnTinMn12-Sep-13 4:34 
Quote:
I inserted a breakpoint to try to find the problem and what I found is that after the execution of the SelectAll() instruction the LostFocus event is fired
You observed the LostFocus event after hitting your breakpoint in GotFocus because the breakpoint transfered the focus to the debugger. Ain't event debugging fun? Poke tongue | ;-P

I believe that you will need a custom control to change the default handling mouse handling to get the effect that you want. Here is quick example that intercepts the left mouse button down message to achieve this behavior.

VB
Public Class TBSelectOnEnter
   Inherits TextBox

   Protected Overrides Sub OnEnter(ByVal e As System.EventArgs)
      SelectAll()
      MyBase.OnEnter(e)
   End Sub

   Private Const WM_LBUTTONDOWN As Int32 = &H201
   Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
      ' only intercept WM_LBUTTONDOWN if not focused to allow caret positioning with subsequent clicks
      If Not Focused AndAlso (m.Msg = WM_LBUTTONDOWN) Then
         'grab focus, abort message processing
         Me.Focus()
      Else
         MyBase.WndProc(m)
      End If
   End Sub
End Class
Just add this to your code and do a build. It should show up in your toolbox at the top in the "YourApplicationName Components" section. Then use it as your TextBox.
GeneralRe: Textbox keeps losing focus Pin
CJotaO12-Sep-13 8:19
CJotaO12-Sep-13 8:19 
GeneralRe: Textbox keeps losing focus Pin
TnTinMn12-Sep-13 17:14
TnTinMn12-Sep-13 17:14 
GeneralRe: Textbox keeps losing focus Pin
CJotaO12-Sep-13 21:37
CJotaO12-Sep-13 21:37 
QuestionRetreive Data from sql server along with headers or column name Pin
ashu200112-Sep-13 1:24
ashu200112-Sep-13 1:24 
AnswerRe: Retreive Data from sql server along with headers or column name Pin
Dave Kreskowiak12-Sep-13 4:03
mveDave Kreskowiak12-Sep-13 4:03 
QuestionUsing Func(Of TResult) Delegate Pin
Dominick Marciano6-Sep-13 19:14
professionalDominick Marciano6-Sep-13 19:14 
AnswerRe: Using Func(Of TResult) Delegate Pin
TnTinMn7-Sep-13 3:39
TnTinMn7-Sep-13 3:39 
GeneralRe: Using Func(Of TResult) Delegate Pin
Dominick Marciano8-Sep-13 3:28
professionalDominick Marciano8-Sep-13 3:28 
GeneralRe: Using Func(Of TResult) Delegate Pin
TnTinMn9-Sep-13 15:57
TnTinMn9-Sep-13 15:57 
QuestionDisable/enable ctrl+alt+del buttons and autorun. Pin
Otekpo Emmanuel5-Sep-13 14:13
Otekpo Emmanuel5-Sep-13 14:13 
AnswerRe: Disable/enable ctrl+alt+del buttons and autorun. Pin
Dave Kreskowiak5-Sep-13 18:25
mveDave Kreskowiak5-Sep-13 18:25 
GeneralHello Pin
Otekpo Emmanuel6-Sep-13 7:38
Otekpo Emmanuel6-Sep-13 7:38 
GeneralRequest Pin
Otekpo Emmanuel6-Sep-13 7:39
Otekpo Emmanuel6-Sep-13 7:39 
GeneralRe: Request Pin
Dave Kreskowiak6-Sep-13 14:31
mveDave Kreskowiak6-Sep-13 14:31 
AnswerRe: Disable/enable ctrl+alt+del buttons and autorun. Pin
Chris Quinn5-Sep-13 21:20
Chris Quinn5-Sep-13 21:20 
AnswerRe: Disable/enable ctrl+alt+del buttons and autorun. Pin
Eddy Vluggen6-Sep-13 9:26
professionalEddy Vluggen6-Sep-13 9:26 
QuestionDatabase connection using adodc control/autorun Pin
Otekpo Emmanuel5-Sep-13 13:57
Otekpo Emmanuel5-Sep-13 13:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.