Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: willy widji
  Where is willy widji?
 Purwakarta
 Indonesia
 willy widji
 Tags
Subject: RE: connect using MSCOMM32.OCX
Thread ID: 78535 Message ID: 78616 # Views: 6 # Ratings: 0
Version: Visual FoxPro 9 Category: Active X Controls & OLE Automation
Date: Thursday, October 06, 2005 8:55:09 AM         
   


Willy,
You dont's set the TextBox1.Value anywhere in the form. How do you expect it's value to be changed?
Try this.

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
*-- Form: form1 (c:\new folder\rs232.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 10/06/05 09:49:05 AM
*
DEFINE CLASS form1 AS form


Top = 0
Left = 0
Height = 250
Width = 576
DoCreate = .T.
Caption = "Form1"
Name = "Form1"


ADD OBJECT command1 AS commandbutton WITH ;
Top = 168, ;
Left = 108, ;
Height = 27, ;
Width = 84, ;
Caption = "Command1", ;
Name = "Command1"


ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
FontSize = 24, ;
BackStyle = 0, ;
Caption = "Receive Form", ;
Height = 39, ;
Left = 214, ;
Top = 13, ;
Width = 198, ;
Name = "Label1"


ADD OBJECT olecontrol1 AS olecontrol WITH ;
Top = 36, ;
Left = 36, ;
Height = 100, ;
Width = 100, ;
OleClass = "MSCOMMLib.MSComm.1"
Name = "Olecontrol1"


ADD OBJECT edit1 AS editbox WITH ;
Height = 183, ;
Left = 216, ;
Top = 54, ;
Width = 353, ;
Name = "Edit1"


PROCEDURE Init
IF FILE("c:\test.hlp")
ERASE c:\test.hlp"
ENDIF

ENDPROC


PROCEDURE command1.Click
* CLICK event of button

*This tells the transmitting side to start sending the file
Thisform.Olecontrol1.output = CHR(26)
ENDPROC


PROCEDURE olecontrol1.OnComm
*** ActiveX Control Event ***
* OnComm event

IF This.CommEvent = 2 AND This.InBufferCount > 0
m_buff = this.Input
STRTOFILE(m_buff, "c:\test.hlp", 1)
thisform.Edit1.Value = thisform.Edit1.Value + m_buff
this.output = CHR(26)
ENDIF
ENDPROC


PROCEDURE olecontrol1.Init
* INIT event of OleControl1
* 28800 baud, no parity, 8 data, and 1 stop bit.

This.Settings = "9600,N,7,1"
This.InputLen = 3
This.CommPort = 1
This.PortOpen = .T.
ENDPROC

PROCEDURE Destroy
*** It is always a good idea to CLOSE the port before exiting
Thisform.OleControl1.PortOpen = .f.
ENDPROC

ENDDEFINE
*
*-- EndDefine: form1
**************************************************


ENTIRE THREAD

connect using MSCOMM32.OCX Posted by willy widji @ 10/5/2005 8:00:15 AM
RE: connect using MSCOMM32.OCX Posted by Borislav Borissov @ 10/6/2005 8:55:09 AM