home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 8,901 of 10,840   
   Sonoman to All   
   textBox text format   
   23 Oct 04 17:44:19   
   
   From: billgates@microsoft.com   
      
   hi all:   
   I am trying to write a program using VB6. This program loops (well, not   
   yet) and reads a constant data stream from a serial port. Then it   
   outputs the "formatted" data to a textBox and writes it to a file. Well,   
   I have no Idea how to go about this because I have never used VB. I   
   think I am making some good progress so far but I need some help to keep   
   going. What I currently have pops a small window that has an OK button   
   (which I want to get rid off, but if I do the program does not print to   
   the textBox), depending on how long I take to click OK it puts different   
   amounts of streamed data in a buffer, then after I click OK it prints my   
   3 variables (coming in from the serial port) to the textBox in a   
   continuous line with many sets of data.   
      
   That is what I have, now what I want is a different thing. I want to be   
   able to print my three variables (x, y, and z axis) separated by a space   
   on one line for one reading, then the next reading on the next line and   
   so on. At the same time write to a file with the same format. I think   
   the main thing for me is to get the input in the right format before   
   sending it to the textBox or to write to a file.   
      
   The data that I have coming in from the serial port is coming at   
   intervals of 4 sets of data per second (adjustable), there is a space   
   between the second an third pieces of data per set and a carriage return   
   after the third. Each set of data contains three values.   
      
   My main thing right now is to format the input and print to the textBox   
   one set of data per line. I gave you all the extra info just in case you   
   needed it.   
      
   This is my code:   
      
   Private Sub Command1_Click(Index As Integer)   
   MSComm1.CommPort = 5   
   MSComm1.Settings = "9600,N,8,1"   
   MSComm1.PortOpen = True   
   MsgBox MSComm1.InBufferCount   
   MSComm1.InputMode = comInputModeText   
   Text1.Text = MSComm1.Input   
   MsgBox MSComm1.Input   
   MSComm1.PortOpen = False   
   End Sub   
      
   Please advise.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca