Private Sub Glass_Click(sender As System.Object, e As System.EventArgs) Handles Glass.Click
Dim strBatch As String = lstBatch.Text
If strBatch = "" Then
MsgBox("Please select a batch and try again")
Exit Sub
End If
'Dim cn As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source = THOECHERL-PC;Initial Catalog = TWO; " & _
' "Persist Security Info= True;Connection Timeout = 0;User ID=sa;Password=Great Plains!")
Dim cn As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source = THOR;Initial Catalog = TEST2; " & _
"Persist Security Info= True;Connection Timeout = 0;User ID=sa;Password=Great Plains!")
'Dim Port As Devices.Ports
Dim Port As String
Dim Host, Button As String
Dim Header As String
Dim LabelFormat As String
Dim Bin, Assorted_bin, Item_number, Custname, Order_Number, Batch_Number, Color, Order, Customer, Batch As String
Dim Glass_Assorted_bin, Glass_Type_1, Glass_Type_2, Mull_Config, Mull_Location, Special_Instructions, WinPart, GlassSize, Glass_Field, MullInfo, Spec_Inst, AssBin, PartNum, BarcodeOrder, AssortBin As String
Dim Line_Number, SeriesQty As Integer
Dim Spacer_Thickness, Qty, FixedWidth, FixedHeight, VentWidth, VentHeight, ScreenHeight, ScreenWidth As String
Dim Quantity As Double
Button = Glass.Name.ToString
Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cn.Open()
cmd.CommandText = "SELECT PORT FROM PCT_LABEL_CONFIG WHERE NAME = '" & Button & "'"
Port = cmd.ExecuteScalar()
cmd.CommandText = "SELECT HOST FROM PCT_LABEL_CONFIG WHERE NAME = '" & Button & "'"
Host = cmd.ExecuteScalar()
cmd.CommandText = "SELECT HEADINGFORMAT FROM PCT_LABEL_CONFIG WHERE NAME = '" & Button & "'"
Header = cmd.ExecuteScalar()
cmd.CommandText = "SELECT LabelFormat FROM PCT_LABEL_CONFIG WHERE NAME = '" & Button & "'"
LabelFormat = cmd.ExecuteScalar()
cn.Close()
Dim IPs As IPHostEntry = Dns.GetHostEntry(Host) ' Grab this host's IPs
Dim IP As IPAddress = IPs.AddressList(0) ' Let's use the first IP listed for this host.
Dim EP As New IPEndPoint(IP, Port) ' Establish an endpoint.
PrintSocket.Connect(EP) ' Connect the socket.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>C<ETX>" & vbCrLf)) ' Clean slate for commands.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>P<ETX>" & vbCrLf)) ' Enter programming mode.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>E5;F5;<ETX>" & vbCrLf)) ' Erase format 5, Start programming format 5
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>" & Header & "<ETX>" & vbCrLf)) ' Send the two field definitions from our table.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>R<ETX>" & vbCrLf)) ' End of programming mode
' The next four lines are the heading label's data
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>E5<CAN><ETX>" & vbCrLf)) ' Announce label data should use format 5
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>" & Button & "<CR><ETX>" & vbCrLf)) ' The first field is the name of the report
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>" & strBatch & "<CR><ETX>" & vbCrLf)) ' The second and final field is the batch numnber.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ETB><ETX>" & vbCrLf)) ' End of this label.
' These lines are the format info for the label body
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>C<ETX>" & vbCrLf)) ' Clean slate for commands.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>P<ETX>" & vbCrLf)) ' Enter programming mode.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>E5;F5;<ETX>" & vbCrLf)) ' Erase format 5, Start programming format 5
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>" & LabelFormat & "<ETX>" & vbCrLf)) ' Send the field definitions from our table.
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX>R<ETX>" & vbCrLf)) ' End of programming mode
PrintSocket.Send(System.Text.Encoding.ASCII.GetBytes("<STX><ESC>E5<CAN><ETX>" & vbCrLf)) ' Announce label data should use format 5
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
-Mike Kapnisakis, Warner Bros
With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. You'll also be able to connect with highly specified Experts to get personalized solutions to your troubleshooting & research questions. It’s like crowd-sourced consulting.
We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Our certified Experts are CTOs, CISOs, and Technical Architects who answer questions, write articles, and produce videos on Experts Exchange. 99% of them have full time tech jobs - they volunteer their time to help other people in the technology industry learn and succeed.
We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.
Our community of experts have been thoroughly vetted for their expertise and industry experience.