Shop OBEX P1 Docs P2 Docs Learn Events
Visual Basic 5 to Stamp (VB Help) — Parallax Forums

Visual Basic 5 to Stamp (VB Help)

L_GamindeL_Gaminde Posts: 29
edited 2010-11-16 08:39 in BASIC Stamp
Im working on a VB5 to stamp 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 stamp 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.

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-10-31 17:57
    Hi , maybe a list box

    example

    Dim x As Integer

    For x = 0 To 5
    List1.AddItem ("YO" + vbCr)

    Next

    Jeff T.
  • L_GamindeL_Gaminde Posts: 29
    edited 2010-10-31 18:19
    Yes I think this would work because "YO" is in quotes I tried doing it this way but when Im passing varables it doesn't ( below )

    Txttout.text = Chr(32) & Chr(32) & Chr(32) & Chr(32) & Chr(32) & Chr(32) & Chr(32) & byte1 & byte2 & Chr(58) & byte3 & byte4 & Chr(32) & Chr(32) & byte5 & byte6 & Chr(47) & byte7 & byte8 & vbcrlf
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2010-11-01 19:46
    L_Gaminde and Jeff--

    Ha! I've got exactly the same issue. I am recording date, time, temperature, and humidity via a BS2 and Sensirion Temperature/Humidity Sensor and VB6. Although I would like for the data to look nice on the screen, it is not too important since I write it to disk for later use.

    Still, it WOULD be good if it looked nice on the screen! :)

    I haven't cut VB code in a long, long time so I am out of practice and have forgotten a lot. I'll try the list box idea. Currently, I am using a text box. I wonder if it has something to do with the serial input buffer length?

    --Bill
  • L_GamindeL_Gaminde Posts: 29
    edited 2010-11-02 11:40
    Bill great your having trouble Misery loves company!

    I think its a variable thing the data is there and correct just can't make it go to the next line using " " works but then its not a vairable.

    Try using a Picture box and using the print statement with a variable mystr or any name or number of varialbes and it works great but you lose data when the box is full and there is no way of scrolling a picture box ( or is there ).

    picture1.print mystr 'this works great till box is full

    i also write it to disk but I feel like an idiot not being able to make this work!!
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2010-11-02 14:50
    L_Gaminde,

    What level of scrolling are you looking for?

    Here is a You-Tube link to something I was toying with written in VB4 ...

    http://www.youtube.com/user/ICPolyman#p/a/u/0/xl2F4oHtvhE

    ...It graphically scrolls a PictureBox using the native tools to make a 'ticker tape'... i.e. no API calls


    With graphics it's a bit complex, but if you are just wanting to do text, then your already on the right track.

    Your example ...

    "picture1.print mystr 'this works great till box is full"

    might just need a little overhead maintenance. Such as using the MID function with 'mystr' to limit what is printed. Also you might need to make use of ...

    "Picture1.CurrentX" and "Picture1.CurrentY"

    ...to manually re-position your cursor prior to printing partial MID segments of 'mystr'.

    Doing that should allow you to scroll in any direction.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-11-02 14:54
    Hi , without seeing an example of what you have tried it's hard to say.

    Here is a text box example that uses various data types in a loop , it takes a variable byte a variable string the constant vbNewLine and uses the Space(n) instruction. The two properties to change in the text control are MultiLine=True and ScrollBars=Vertical

    Dim x As Byte
    Dim mytext As String
    mytext = "hello" & vbNewLine
    Text1.Text = ""
    For x = 0 To 100
    Text1.Text = Text1.Text & x & Space(2) & mytext
    Next

    If the newline is to be controlled by the device and not the VB app then append Chr(13) & Chr(10) to the string.

    Jeff T.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-11-03 08:01
    Nice demo Beau , is the source available? (spin & VB)

    Jeff T.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2010-11-03 09:42
    L_Gaminde,

    Sorry to Hi-jack your thread. Attached at the bottom of this page is a VB4 example for fine text scrolling. Click on the picture box to start the demo.


    Unsoundcode,

    Thanks... "is the source available?" - it will be when I work out more of the code. Right now the Analog meters are locked to the bar graphs for testing purposes of building the meters, but the Spin code is simple...
    Ticker Tape: (Standard)
    - uses a four byte command string
    - the first two bytes are the command SYNC defined as "!T"
    - the third byte indicates the channel you want to assign the data to.
    - the fourth byte is the actual data
     
    BarGraph: (Standard)
    - uses a four byte command string
    - the first two bytes are the command SYNC defined as "!B"
    - the third byte indicates the channel you want to assign the data to.
    - the fourth byte is the actual data
    
    Ticker Tape: (Packet)
    - uses a variable byte command string
    - the first three bytes are the command SYNC defined as "!XT"
    - the fourth byte indicates the length or "N" of the data packet.
    - the fifth byte indicates the first channel you want to assign the data to.
      Successive channels enumerate upwards from this position. 
    - the sixth byte all the way to the "5+N" byte contain the actual data
    
    Bar Graph: (Packet)
    - uses a variable byte command string
    - the first three bytes are the command SYNC defined as "!XB"
    - the fourth byte indicates the length or "N" of the data packet.
    - the fifth byte indicates the first channel you want to assign the data to.
      Successive channels enumerate upwards from this position. 
    - the sixth byte all the way to the "5+N" byte contain the actual data
    
    

    ...The Analog meters would code in a similar way.
  • L_GamindeL_Gaminde Posts: 29
    edited 2010-11-04 17:05
    Thanks everyone will be working on this more next week when weather turns bad ( mid 60s ) its 90 now and working outside love the heat.

    Beau It will be weeks for me to digest this so don't go anywhere I will get back to you.
  • L_GamindeL_Gaminde Posts: 29
    edited 2010-11-13 15:23
    These two lines will scroll text in a text box using visual basic and downloading from a stamp. just change mystr to your variable name.

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

    Thanks to rsocor01 from another list
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2010-11-16 08:39
    L_Gaminde--

    Thank you very much!

    --Bill
Sign In or Register to comment.