Click here to Skip to main content
15,884,298 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: My Application takes Very CPU usage and Memory Pin
Dave Kreskowiak30-Jan-09 1:55
mveDave Kreskowiak30-Jan-09 1:55 
GeneralRe: My Application takes Very CPU usage and Memory Pin
Anubhava Dimri29-Jan-09 22:18
Anubhava Dimri29-Jan-09 22:18 
GeneralRe: My Application takes Very CPU usage and Memory Pin
Ashutosh Phoujdar29-Jan-09 23:16
Ashutosh Phoujdar29-Jan-09 23:16 
GeneralRe: My Application takes Very CPU usage and Memory Pin
Anubhava Dimri30-Jan-09 0:59
Anubhava Dimri30-Jan-09 0:59 
QuestionHow to copy conditional rows and paste them in new worksheet. Pin
jptxrose28-Jan-09 10:56
jptxrose28-Jan-09 10:56 
QuestionAutoscroll in textbox Pin
Kschuler28-Jan-09 5:17
Kschuler28-Jan-09 5:17 
AnswerRe: Autoscroll in textbox Pin
Mr Oizo28-Jan-09 22:47
Mr Oizo28-Jan-09 22:47 
GeneralRe: Autoscroll in textbox Pin
Kschuler29-Jan-09 4:25
Kschuler29-Jan-09 4:25 
Thanks for taking the time to help me. It's not quite what I was after, but it's a step in the right direction. I want the autoscroll to the bottom to happen only the first time they click...if they click once to get focus and then click again because they are trying to highlight a word or edit text it should not scroll. So I did this:

Dim intMouseClickCounter As Integer = 0
Private Sub txtInput_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtInput.GotFocus
    Dim strAutoLabel As String = gblstrUserName.Trim & " - " & Now.ToString("M/d/yy")

    'If the textbox does not contain the auto label, add it
    If Not txtInput.Text.Contains(strAutoLabel) Then
        If txtInput.Text.Trim.Length <> 0 Then txtInput.Text &= vbCrLf & vbCrLf
        txtInput.Text &= strAutoLabel & vbCrLf
        txtInput.SelectionStart = txtInput.Text.Length
        txtInput.ScrollToCaret()

        'Set counter to one so the mouseclick event will scroll to the bottom
        intMouseClickCounter = 0
    Else
        'Set counter to one so the mouse click will not scroll to the bottom
        intMouseClickCounter = 1
    End If

End Sub

Private Sub txtSpecialReport_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtInput.MouseClick
    If intMouseClickCounter = 0 _
    AndAlso Not (txtInput.SelectionStart = txtInput.Text.Length) Then
        txtInput.SelectionStart = txtInput.Text.Length
        txtInput.SelectionLength = 0
        txtInput.ScrollToCaret()
    End If

    'Increment counter so if user clicks inside textbox after focus has already been set,
    'the code to scroll to the bottom will not run again
    intMouseClickCounter += 1

End Sub

Private Sub txtInput_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtInput.LostFocus
    intMouseClickCounter = 0 'Reset counter
End Sub


But this solution has flaws. It doesn't work the way I'd like when a user tabs into the textbox, and it will scroll when I don't want it to if the user activates another window/program and then returns to this form and this textbox. If anyone has any further suggestions I would appreciate it.
Questioncould not find installable ISAM Pin
NaliniNagarajan28-Jan-09 2:56
NaliniNagarajan28-Jan-09 2:56 
AnswerRe: could not find installable ISAM Pin
Dave Kreskowiak29-Jan-09 3:14
mveDave Kreskowiak29-Jan-09 3:14 
QuestionProblem running remote process using WMI [modified] Pin
thecornflake28-Jan-09 2:07
thecornflake28-Jan-09 2:07 
AnswerRe: URGENT problem running remote process using WMI Pin
EliottA28-Jan-09 2:55
EliottA28-Jan-09 2:55 
GeneralRe: URGENT problem running remote process using WMI Pin
thecornflake28-Jan-09 3:09
thecornflake28-Jan-09 3:09 
GeneralRe: URGENT problem running remote process using WMI Pin
EliottA28-Jan-09 3:19
EliottA28-Jan-09 3:19 
GeneralRe: URGENT problem running remote process using WMI Pin
thecornflake28-Jan-09 3:21
thecornflake28-Jan-09 3:21 
GeneralRe: URGENT problem running remote process using WMI Pin
thecornflake28-Jan-09 4:32
thecornflake28-Jan-09 4:32 
GeneralRe: URGENT problem running remote process using WMI Pin
Uros Calakovic28-Jan-09 5:29
Uros Calakovic28-Jan-09 5:29 
GeneralRe: URGENT problem running remote process using WMI Pin
thecornflake28-Jan-09 5:50
thecornflake28-Jan-09 5:50 
Questionhow to develop print dialog box Pin
vidhish27-Jan-09 23:37
vidhish27-Jan-09 23:37 
AnswerRe: how to develop print dialog box Pin
dan!sh 28-Jan-09 0:04
professional dan!sh 28-Jan-09 0:04 
QuestionHelp Pin
yaya_star27-Jan-09 21:15
yaya_star27-Jan-09 21:15 
AnswerRe: Help Pin
Ashutosh Phoujdar27-Jan-09 21:29
Ashutosh Phoujdar27-Jan-09 21:29 
QuestionODBC Pin
Stephen Lintott27-Jan-09 21:08
Stephen Lintott27-Jan-09 21:08 
AnswerRe: ODBC Pin
Jay Royall27-Jan-09 22:37
Jay Royall27-Jan-09 22:37 
AnswerRe: ODBC Pin
Wendelius27-Jan-09 22:43
mentorWendelius27-Jan-09 22:43 

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.