CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2001
    Posts
    3

    Displaying Results within a Text Box

    I need help displaying the results of my variables within a text box. Basically, I need to be able to display 3 variables within a text box.

    Basically, I can get the output what I want, and the content is perfect, but the alignment is the problem.

    I've tried vbTab and vbCrlf and the formatting isn't right.

    What I'm trying to do is to take the DATE from DateResults and put it on the SAME LINE as the Results from Domain 1 and Domain 2. Then for the next file, it will display on the next line.

    Below is what I have so far. As of right now, the date gets displayed on the top of the text box and the results gets displayed on the bottom -- I want to merge the two.

    thanks for your help

    'Searching for Date/Time/Year statistics
    Dim varWhen As String
    varWhen = InStr(1, strContent, 28)

    Dim DateResults As String
    DateResults = InStr(1, strContent, "Tue")

    Dim strWhen, strDateDisplay As String
    strWhen = strContent
    strDateDisplay = Mid(strContent, DateResults, 28)
    'MsgBox strDateDisplay

    'Searching for Number of Connections in Domain 1
    Dim Results As Integer
    Results = InStr(1, strContent, ">")
    'MsgBox (Results) (for use when figuring out what character position the > is in)

    Dim strVar, strSearch As String
    strVar = strContent
    strSearch = Mid(strContent, Results + 2, 3)

    'Display the results of search for Domain 1
    txtResults.Text = strDateDisplay & vbTab & txtResults.Text & Int(strSearch)

    'Searching for Number of Connections in Domain 2
    Results = InStr(Results + 1, strContent, ">")
    strSearch = Int(Mid(strContent, Results + 2, 3))

    'Display the results of search for Domain 2
    txtResults.Text = strDateDisplay & vbTab & txtResults.Text & vbTab & strSearch & vbCrLf

    'Display the last selected file in the txtFileContent textbox
    txtFileContent.Text = strContent




  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Displaying Results within a Text Box

    TextBoxes are for unformatted text and are best left to that. You probably need to look into either MSFlexGrid or MSHFlexGrid if you want some Spreadsheet like formatting.
    For something real simple, Try using a PictureBox with the Courier font. You should be able to use Tabs with it but decimal point alignment will be a problem with multiple rows
    here is a quickie example using a Picturebox. MsFlexgrid and MSHFlexgrid are more complicated
    but do a nice job of text alignment

    Picture1.print "001" & vbTab & "0003" & vbTab; "1234"




    John G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured