Вот код Бейсика:
Imports ScLoad
Imports System.Text
Imports System.IO
Imports System
Public Class frmMain
Private WithEvents plu As New PLU
Private ScaleCodepage As String
Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
Application.DoEvents()
plu.SendPLU()
End Sub
Private Sub plu_ErrorMessageScales(ByVal result As String) Handles plu.ErrorMessageScales
If Not result = String.Empty Then MessageBox.Show(result)
End Sub
Private Sub plu_PluHexFile(ByVal message As String) Handles plu.PluHexFile
Me.RichTextBox1.Text = message
Me.RichTextBox1.Refresh()
End Sub
Private Sub plu_SendingMessage(ByVal message As String) Handles plu.SendingMessage
ToolStripStatusLabel1.Text = message
StatusStrip1.Refresh()
End Sub
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'txtScales.Text = "192.168.2.21;windows-1257 192.168.2.22;ibm775 192.168.2.23;windows-1257 "
Me.txtScales.Text = "192.168.32.87"
Me.txtComName.Text = "Jahutatud broilerifilee (pakendatud gaasikeskkonda)"
Me.chkWeighed.Checked = True
Me.txtLabel1FR.Text = "12"
Me.txtUsedByDate.Text = "2"
Me.chkPackedDatePrint.Checked = True
Me.chkCommUcase.Checked = True
BindComboCodepages()
'Codepages
'Baltic (ISO), iso-8859-4, iso-8859-4
'Baltic (Windows), windows-1257, windows-1257
'775: Baltic (DOS), ibm775, ibm775
'850: Western(European(DOS), ibm850, ibm850)
End Sub
Private Sub BindComboCodepages()
'cmbCharacterSize.Items.AddRange(FontSize)
'cmbCharacterSize.ValueMember.Insert(0, "00")
'cmbCharacterSize.ValueMember.Insert(1, "01")
Dim cmbArray As New ArrayList
cmbArray.Add(New ValueDescriptionPair("ibm775", "Baltic (DOS) 775"))
cmbArray.Add(New ValueDescriptionPair("ibm850", "Western European (DOS) 850"))
cmbArray.Add(New ValueDescriptionPair("ibm852", "Central European (DOS) 852"))
cmbArray.Add(New ValueDescriptionPair("windows-1250", "Central European (Windows) 1250"))
cmbArray.Add(New ValueDescriptionPair("windows-1251", "Cyrillic (Windows) 1251"))
cmbArray.Add(New ValueDescriptionPair("Windows-1252", "Western European (Windows) 1252"))
cmbArray.Add(New ValueDescriptionPair("windows-1257", "Baltic (Windows) 1257"))
'cmbArray.Add(New ValueDescriptionPair("utf-8", "Unicode (UTF-8)"))
'cmbArray.Add(New ValueDescriptionPair("utf-32", "Unicode (UTF-32)"))
With cmbScaleCodepage
.DisplayMember = "Description"
.ValueMember = "Value"
.DataSource = cmbArray '.DataSource = dsData.Tables("CharacterSize")
End With
cmbScaleCodepage.SelectedIndex = 0
Dim bFound As Boolean
Dim ItemCount As Integer
Dim SelVal As Short
Dim strFormatValue As Short
Dim cbItemCount As Integer
ItemCount = -1
cbItemCount = cmbScaleCodepage.Items.Count
While Not bFound Or ItemCount <= cbItemCount - 1
If strFormatValue = SelVal Then
Exit While
bFound = True
End If
ItemCount += 1
If ItemCount >= cbItemCount Then
cmbScaleCodepage.SelectedIndex = cbItemCount - 1
Exit While
End If
cmbScaleCodepage.SelectedIndex = ItemCount
End While
End Sub
Private Sub cmbScaleCodepage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbScaleCodepage.SelectedIndexChanged
ScaleCodepage = CType(cmbScaleCodepage.SelectedItem, ValueDescriptionPair).Value
Me.ToolStripStatusLabel1.Text = ScaleCodepage
End Sub
Private Sub cmdCreateFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCreateFile.Click
plu.set_ScalesIP(txtScales.Text.Trim)
plu.set_ScalesCodepage(ScaleCodepage)
If Me.chkCommUcase.Checked Then
plu.set_CommodityUCASE(True)
Else
plu.set_CommodityUCASE(False)
End If
If Not Me.txtCommodityFontSize.Text = String.Empty Then plu.set_CommodityCharSize(Me.txtCommodityFontSize.Text)
If Not Me.txtCommodityMaxRowLen.Text = String.Empty Then plu.set_CommodityRowMaxLen(CShort(Me.txtCommodityMaxRowLen.Text))
plu.CreatePlu(True, Me.txtPlu.Text, Me.txtItemCode.Text, Me.txtUnitPrice.Text, _
Me.chkWeighed.Checked, Me.txtLabel1FR.Text, Nothing, Me.txtComName.Text, Me.txtPluTare.Text, _
Me.txtUsedByDate.Text, Me.chkPackedDatePrint.Checked)
End Sub
Private Sub cmdAppend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAppend.Click
plu.set_ScalesIP(txtScales.Text.Trim)
plu.set_ScalesCodepage(ScaleCodepage)
If Me.chkCommUcase.Checked Then
plu.set_CommodityUCASE(True)
Else
plu.set_CommodityUCASE(False)
End If
If Not Me.txtCommodityFontSize.Text = String.Empty Then plu.set_CommodityCharSize(Me.txtCommodityFontSize.Text)
If Not Me.txtCommodityMaxRowLen.Text = String.Empty Then plu.set_CommodityRowMaxLen(CShort(Me.txtCommodityMaxRowLen.Text))
plu.CreatePlu(False, Me.txtPlu.Text, Me.txtItemCode.Text, Me.txtUnitPrice.Text, _
Me.chkWeighed.Checked, Me.txtLabel1FR.Text, Nothing, Me.txtComName.Text, Me.txtPluTare.Text, _
Me.txtUsedByDate.Text, Me.chkPackedDatePrint.Checked)
End Sub
Private Sub txtScales_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtScales.TextChanged
End Sub
Private Sub txtUnitPrice_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUnitPrice.TextChanged
End Sub
Private Sub txtPluTare_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPluTare.TextChanged
End Sub
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
End Sub
Private Sub txtPlu_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPlu.TextChanged
End Sub
Private Sub txtItemCode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtItemCode.TextChanged
End Sub
Private Sub txtUsedByDate_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUsedByDate.TextChanged
End Sub
Private Sub chkPackedDatePrint_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkPackedDatePrint.CheckedChanged
End Sub
Private Sub chkWeighed_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkWeighed.CheckedChanged
End Sub
Private Sub txtLabel1FR_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLabel1FR.TextChanged
End Sub
Private Sub txtComName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtComName.TextChanged
End Sub
Private Sub chkCommUcase_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkCommUcase.CheckedChanged
End Sub
Private Sub txtCommodityMaxRowLen_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCommodityMaxRowLen.TextChanged
End Sub
Private Sub txtCommodityFontSize_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCommodityFontSize.TextChanged
End Sub
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
End Sub
End Class
Public Class ValueDescriptionPair
Public Value As Object
Public Description As String
Public Sub New(ByVal NewValue As Object, ByVal NewDescription As String)
Value = NewValue
Description = NewDescription
End Sub
Public Overrides Function ToString() As String
Return Description
End Function
End Class
Добавлено через 2 минуты 45 секунд
этот код бейсика ведь тоже импортирует dll-файл
Добавлено через 8 минут 33 секунды
это не bas-файл. Это vb-файл.