VB5 to Pic VB5 Help


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153

    Default VB5 to Pic VB5 Help

    Im working on a VB5 to pic project, I need some help with a text box. Im unable to scroll data to this box using multiline and scroll bar, vbCrLf does not work chr(13) & chr(10) nothing works. if I put the vbCrLf as the first item on the line it drops down one line and prints all input on that line instead of scrolling.
    This is time and date data from the pic and a 1307 rtc. I am able to scroll into a picture box using print. I have tried to break each byte out used the string, used formatting it all works in the picture window but scrolls off page, picture windows do not have scroll bars so some data gets lost.

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Post your VB5 code and I might be able to tell you what is wrong.

    Note: This is probably a wrong forum section to ask VB5 questions.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  3. #3
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Pic to VB5

    Yes on the wrong forum it is data from a Pic

    Text1.Text = byte1 & byte2 & byte3

    adding vbcrlf or chr(13) or chr(10) has no effect on text box
    if I do
    text1.text = " I feel like " vbcrlf will go to the next line
    but variables will not

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by l_gaminde View Post
    Yes on the wrong forum it is data from a Pic

    Text1.Text = byte1 & byte2 & byte3

    adding vbcrlf or chr(13) or chr(10) has no effect on text box
    if I do
    text1.text = " I feel like " vbcrlf will go to the next line
    but variables will not
    Try it like this

    Text1.Text = byte1 & vbcrlf & byte2 & vbcrlf & byte3
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default vb5

    no it will not work with a variable
    this is what I see from this
    Text1.Text = mystr & vbCrLf & mystr & vbCrLf
    88"88 88/88||88:88 88/88||
    but when i copy and paste I get below it pastes with cr lf
    This is really odd

    88:88 88/88
    88:88 88/88

    The double lines are thicker I do not see them on my ansi chart

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    I use VB6, but I am not familiar with VB5. However, they should be more or less the same.

    Try a Label box instead of a Text box. The following code works fine for me, because I just took it from one of my working VB6 programs.

    Code:
    Label1.Caption = byte1 & vbcrlf & byte2 & vbcrlf & byte3
    If you still insist in using a Text box, then the following might help you. This quote is taken from a VB6 help file.

    To display multiple lines of text in a TextBox control, set the MultiLine property to True. If a multiple-line TextBox doesn't have a horizontal scroll bar, text wraps automatically even when the TextBox is resized. To customize the scroll bar combination on a TextBox, set the ScrollBars property.

    Scroll bars will always appear on the TextBox when its MultiLine property is set to True, and its ScrollBars property is set to anything except None (0).

    If you set the MultiLine property to True, you can use the Alignment property to set the alignment of text within the TextBox. The text is left-justified by default. If the MultiLine property is False, setting the Alignment property has no effect.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default Pic to VB5

    Ok some of this worked and some did not I will be working on this again next week.
    I have not given up just had problems (KIDS) thanks and will post more next week

  8. #8
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default vb5 to Pic

    Quote Originally Posted by rsocor01 View Post
    I use VB6, but I am not familiar with VB5. However, they should be more or less the same.

    Try a Label box instead of a Text box. The following code works fine for me, because I just took it from one of my working VB6 programs.

    Code:
    Label1.Caption = byte1 & vbcrlf & byte2 & vbcrlf & byte3
    If you still insist in using a Text box, then the following might help you. This quote is taken from a VB6 help file.
    I tried your example and it worked but try this and let me know if it works for you


    label1.Caption = byte1 & byte2 & byte3 & vbcrlf

    now go through this 5 times and see if it goes to the next line or stays on one line

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    It stays on one line. Remember you are changing the caption of the label object.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  10. #10
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default vb5 to pic

    Quote Originally Posted by rsocor01 View Post
    It stays on one line. Remember you are changing the caption of the label object.

    Robert

    Robert No I don't understand what your saying changing the caption Im lost
    I want byte1 byte2 and byte3 on one line, then the next line down the same thing this is serial data so byte1-3 are different values on each line, there just being used for formatting a string value so the layout is simple and easy.

  11. #11
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default vb5

    this is what my data looks like


    Name:  New Picture.bmp
Views: 877
Size:  194.1 KB

  12. #12
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    L_gaminde,

    The next code works fine because I just tested it with VB6 in my PC. I expect that it should work for you too with your VB5 version.

    - Create a textbox
    - Set multiline to true
    - Set scrollbars to "3 - both"
    - Use the following code

    Code:
    Text1.text = Byte1 & vbCrLf    'This is the first line
    
    Text1.SelStart = Len(Text1)    'Finds the starting point to append text
    Text1.SelText = Byte2 & vbCrLf   'Appends text
    
    Text1.SelStart = Len(Text1)    'Finds the starting point to append text
    Text1.SelText = Byte3 & vbCrLf   'Appends text
    Use the code for the first line only once if you want the results to keep scrolling.

    Robert

    Edit: The code I gave you in a previous post works for VB.net. Wrong version .
    Last edited by rsocor01; - 13th November 2010 at 04:53. Reason: Clarification
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  13. #13
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default VB5 2 Pic

    This is what I tried

    Text1.Text = mystr & vbCrLf
    Text1.SelStart = Len(Text1) 'Finds the starting point to append text
    Text1.SelText = mystr & vbCrLf 'Appends text



    This is what I get!! two lines that both lines change as data comes in.

    88:88 88/88
    88:88 88/88

  14. #14
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Like I said before, use the first line of code only once. Use the other two lines of code for the rest of the incomming data.

    Using the first line again and again will "reset" the text in your textbox. If you need help post all your code. This code works fine because I tested it.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  15. #15
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default vb5

    I don't understand, I only used the first line once. I have one formatted variable mystr! Im getting this data through an oncomm when I get 9 bytes of data it fires and sets up my string sData, sData is then formatted into mystr, and mystr then sent to a file on disk and to a Picture box. I know if I have three lines it will print three lines!! I may have hundreds of lines so I really don't want to wirte 100 + text1.text lines, I want it to loop through the data as it comes in and put it on a line below the last. I have a counter running wonder if I can use the count value to tell the text box to drop one line and print can a text box be told which line to print on. This is basically a do loop where mystr is reloaded with new data each pass and then printed. Now when using the write or print commands with this data it works perfect but print and write do not work with a text box or lable box. Right now Im using to picture boxes when one fills up it goes on to the next but sometimes both fill up and I loose some data guess another picture box or two would help, bout could fill them also.




    Public Sub MSComm1_ONComm()
    If MSComm1.CommEvent = comEvReceive Then
    sData = MSComm1.Input
    cnt = cnt + 1
    cnt1 = Format(cnt, "0#")
    If Mid(sData, 1, 1) = "8" Then Command_End
    mystr = Format(sData, " 0#:## 0#/## ")
    FileNum = FreeFile ' Writes New Data To Disc (Named C:\Tracker)
    Open "C:\Tracker.txt" For Append As FileNum
    Print #FileNum, " "; cnt1 & " "; mystr
    Close FileNum
    If cnt <= 43 Then PicData1.Print " "; cnt1 & " "; mystr
    If cnt > 43 Then PicData2.Print " "; cnt1 & " "; mystr
    End If
    End Sub

  16. #16
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Ok, I will make it even simpler. This is the code I'm using to test the multiline feature

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim MyNumber As Long
    Dim I As Long
    
    MyNumber = 0
    
    For I = 0 To 50
        Text1.SelStart = Len(Text1)             'Finds the starting point to append text
        Text1.SelText = MyNumber & vbCrLf       'Appends text
        MyNumber = MyNumber + 100
    Next I
    
    End Sub
    And, this is the result

    Name:  VB6-Pic.JPG
Views: 721
Size:  18.5 KB

    Just try these two lines and they should work

    Code:
        Text1.SelStart = Len(Text1)             'Finds the starting point to append text
        Text1.SelText = MyNumber & vbCrLf       'Appends text
    Make sure you have the next settings correct

    Name:  VB6-Pic01.JPG
Views: 841
Size:  73.7 KB
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  17. #17
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    153


    Did you find this post helpful? Yes | No

    Default VB5 to Pic

    Just try these two lines and they should work

    Text1.SelStart = Len(Text1) 'Finds the starting point to append text
    Text1.SelText = MyNumber & vbCrLf 'Appends text

    For Me Simple is really good!! THIS WORKS !! just changed the mynumber to mystr and bingo scrolls, Ok I just ( learnt somethin )

    Thank You !!
    you spent a lot of time helping! I appreciate it! there was someone else who could use this but forgot who ??

    Thank You
    Larry

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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