• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

How to referesh a textbox?!

Hello group,

I'm using a textbox as Window to show the contents of a log file.It is set to multiline and works fine But although I have set the scrollbar to txtLogView.ScrollBars = fmScrollBarsBoth in code and also visually still it shows one vertical scroll only unless user click into it using mouse then it gets freshed and shows the horizantal bar.

Does anybody know what causes that? and how can I fix it?

Regards,
ak
0
akohan
Asked:
akohan
  • 7
  • 4
1 Solution
 
ajitha75Commented:
set wordwrap to false
0
 
jpaulinoCommented:
Have you tried TextBox1.Update ?
0
 
akohanAuthor Commented:

Yes, I had set WordWrap to false.

Regards,
ak
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
akohanAuthor Commented:


Hi Paul,

there is no such a member function or method as update. Or maybe at least I don't see it in the list. Any advice?

Regards,
ak
0
 
jpaulinoCommented:
Sorry this is in VB.Net. And TextBox1.Refresh ?
0
 
akohanAuthor Commented:

Hi again,

I'm using textbox from a component called Microsoft Form 2.0 to support multilingual feature in my application. It seems this type of textboxes don't support this type of methods becuase it causes an error message claiming "this method is not supported" during runtime.

However, since it is a log viewer and doesn't need to support other languages I'm going to swith to standard textboxes and I will return to you soon.

Thanks,
ak
0
 
akohanAuthor Commented:

Ok, the standard textbox doesn't have any problem with scrollbars and it shows them but I don't see any wrap word option!! the problem is that the text file is like:

Session started in 10/2/2007 10:52:08 AM
Warning : some messages
Error : some messages
Sesssion ended in 10/2/2007 10:55:17 AM

but the textbox shows it as:

Session started in 10/2/2007 10:52:08 AMWarning : some messagesError : some messagesSesssion ended in 10/2/2007 10:55:17 AM
Session started in 10/2/2007 10:52:08 AMWarning : some messagesError : some messagesSesssion ended in 10/2/2007 10:55:17 AM
Session started in 10/2/2007 10:52:08 AMWarning : some messagesError : some messagesSesssion ended in 10/2/2007 10:55:17 AM

What should I do solve this issue?

Regards,
ak


0
 
jpaulinoCommented:
Paste your code
0
 
akohanAuthor Commented:

Sure, I truly appreicate your concern.  Here is the code:


Private Sub Form_Activate()

    On Error GoTo FormActErrHandler

    BtnCloseLogView.SetFocus
   
    Exit Sub
   
FormActErrHandler:

   
    Dim oFile As CFileIO
    Dim strMsg As String
   
    Set oFile = New CFileIO
    strMsg = Err.Description & SEPARATOR & Err.Number
   
    oFile.LogInformation (vbLf & "***Error (Form_Activate): " & Now & SEPARATOR & strMsg)
   
    If bLanguage = False Then
       
        MsgBox strMsg, vbCritical, LoadResString(resCritic)
    Else
   
        MsgBox strMsg, vbCritical, LoadResString(resCritic + 100)
       
    End If
   
   
    Err.Clear
    Set oFile = Nothing
   
End Sub


Private Sub Form_Load()

    On Error GoTo LogViewLoadingErrHandler
   
   
    If bLanguage = False Then
   
        '--English
        logLoadStrings (langEnglish)
       
    Else
   
        '--Japanese
        logLoadStrings (langJapanese)
       
    End If
   
   
    Dim hFile As Long
    Dim oFile As CFileIO
    Dim strLine As String
   
    Set oFile = New CFileIO
   
    hFile = FreeFile
    strIniFilePath = oFile.GetShellAppFolderPath(CSIDL_APPDATA) & OFFICEFOLDER & "History.log"
   
    '--check see if the log file exits
   
    Open strIniFilePath For Input As #hFile
   
    Dim strBuf As String
    strBuf = BLANK
       

    Do While Not EOF(hFile)
   
        Line Input #hFile, strLine
        strBuf = strBuf & strLine
       
    Loop
       
    Close #hFile
   
       
    txtLogView.Text = strBuf  'strLogContents
    Set oFile = Nothing
   
    Exit Sub
   
LogViewLoadingErrHandler:

    Dim strMsg As String
       
    strMsg = Err.Description & SEPARATOR & Err.Number

    oFile.LogInformation (vbLf & "***Error (Form_Load - View log): " & strMsg)
   
    If bLanguage = False Then
   
        MsgBox strMsg, vbCritical, LoadResString(resCritic)
       
    Else
   
        MsgBox strMsg, vbCritical, LoadResString(resCritic + 100)
       
    End If
   
    Set oFile = Nothing
    Err.Clear

   
End Sub
0
 
akohanAuthor Commented:

I think the code has nothing to do with the way the text is shown in textbox. There must be a prperty setting that I'm missing.

Any comment?

Thanks,
ak
0
 
jpaulinoCommented:
Add this to your loop

Do While Not EOF(hFile)
        Line Input #hFile, strLine
        strBuf = strBuf & strLine & vbCrLf
Loop
0
 
akohanAuthor Commented:


Yes. thanks indeed! you are right.


Regards,
ak
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now