How to send data to SerialPort from Module?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to send data to SerialPort from Module?

abbat81
This post was updated on .
Hi all,

on a form I have a Serial Port.
If I can send a data to SerialPort from Fmain:
Print #Sport, Chr$(&H1B); Chr$(&H61); Chr$(2);
how can I do it from Module?
Reply | Threaded
Open this post in threaded view
|

Re: How to send data to SerialPort from Module?

nando_f
One way is to make a function is Fmain which is public called (for example)

public Function Print_Sport(s as String)  'this is in Fmain
  print #sport, s, len(s)
end function

Outside fmain, you can call Fmail.Print_Sport(Chr$(&H1B) & Chr$(&H61))
because it is visible

-Fernando



--
Open WebMail Project (http://openwebmail.org)


---------- Original Message -----------
From: abbat81 <[hidden email]>
To: [hidden email]
Sent: Tue, 3 Jan 2017 07:07:04 -0700 (MST)
Subject: [Gambas-user] How to send data to SerialPort from Module?

> Hi all,
>
> on a form I have a Serial Port.
> If I can send a daa to SerialPort from Fmain:
> Print #Sport, Chr$(&H1B); Chr$(&H61); Chr$(2);
> how can I do it from Module?
>
> --
> View this message in context: http://gambas.8142.n7.nabble.com/How-to-send-data-
> to-SerialPort-from-Module-tp58114.html Sent from the gambas-user mailing list
> archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|

Re: How to send data to SerialPort from Module?

abbat81
Thank you, it works.
And how can I change Form.name in module?

'Module
Public Print_Fmain as String
Print_Fmain = "Fmain2"
Print_Fmain.Print_Sport(Chr$(&H1B) & Chr$(&H61))