Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read top value of MS Access table and write to printer via TCPClient / NetworkStream - Help

Status
Not open for further replies.

TMEAGLE2

MIS
Jun 24, 2003
16
0
0
US
Good day/evening everyone... I'm pretty fluent with basic MS Access (using 2003 here, but have 2007 available if I need some advanced functionality) and I have been fine with doing imports, exports, macros, and have done some custom things underneath buttons and on form loads with some basic VB, etc.. but nothing too intense on the VB side) Today, I have been presented with a challenge of reading an ASCII value from a table and sending that value to a controller for a printer that will be listening on particular IP address and port. After doing some research it look like using TCPClient, NetworkStream commands, etc. Something similar to below (I know this is not complete code). Anyway.. I'm way to raw at this and need some direction. Even starting with how to setup the module or get the right class involved. TCPClient is not recoginized even when I begin to type the code... I was told I needed to istall VB6 or Visual Studio on the system to see this... but no help. So I guess I need 2 things... Some direction in setting up the environment and some direction on the specific code... If I'm way off on the best way to do this I open to any advice. Also saw some example of adding a activeX winsock control to a form that would do the trick. Any help is greatly appreciated. Thanks! TMEAGLE2

Dim PrinterIP As Net.IPAddress
PrinterIP = Net.IPAddress.Parse("192.168.168.7")
Dim MyPrinter As New TcpClient(PrinterIP.AddressFamily)
MyPrinter.Connect(PrinterIP, 1024)
Dim stream As NetworkStream = MyPrinter.GetStream()
Dim data As [Byte]()
data = System.Text.Encoding.ASCII.GetBytes(Me.lblPOSDesc.Text)
stream.Write(data, 0, data.Length)
 
You don't VB6, you need VB.net and Visual Studio, thats a .net class
 
You don't VB6, you need VB.net and Visual Studio, thats a .net class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top