Click here to Skip to main content
15,887,596 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Translating and understanding what this code block does in c#, adn see if I translated it right for me to use. Pin
jkirkerx13-May-16 5:02
professionaljkirkerx13-May-16 5:02 
QuestionData string manipulation in VB 2010 Pin
Gus11312-May-16 0:26
Gus11312-May-16 0:26 
AnswerRe: Data string manipulation in VB 2010 Pin
Richard MacCutchan12-May-16 0:38
mveRichard MacCutchan12-May-16 0:38 
AnswerRe: Data string manipulation in VB 2010 Pin
Robert g Blair12-May-16 12:27
Robert g Blair12-May-16 12:27 
GeneralRe: Data string manipulation in VB 2010 Pin
Gus11313-May-16 2:19
Gus11313-May-16 2:19 
GeneralRe: Data string manipulation in VB 2010 Pin
Gus11318-May-16 4:15
Gus11318-May-16 4:15 
GeneralRe: Data string manipulation in VB 2010 Pin
Robert g Blair18-May-16 10:47
Robert g Blair18-May-16 10:47 
GeneralRe: Data string manipulation in VB 2010 Pin
Gus11318-May-16 19:52
Gus11318-May-16 19:52 
Hi Robert.

The indicator is a XK3101(N). I have found this code to guide me in the right direction but can't get it to work the way I want it.
VB
Public Class Form1

    Dim myport As Array
    Dim strWeight As String

    Public Delegate Sub myDel(ByVal txtBox As TextBox)
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        myport = SerialPort.GetPortNames

        AddHandler SerialPort1.DataReceived, AddressOf SerialPort1_DataReceived
    End Sub

    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived

        txtBox.Invoke(New myDel(AddressOf UpdateTextBox), New Object() {txtBox})
    End Sub

    Public Sub UpdateTextBox(ByVal UpDateTextBox As TextBox)

        Dim bytes As Integer = SerialPort1.BytesToRead
        Dim Buffer(bytes) As Byte

        SerialPort1.Read(Buffer, 0, bytes)

        strWeight = System.Text.Encoding.Default.GetString(Buffer)
        txtBox.AppendText(strWeight)
        GetTareandWeight(strWeight)

    End Sub

    Private Sub GetTareandWeight(ByVal weight As String)

        Dim strWeights() As String
        Dim newWeight As String = Replace(weight, " ", " ")
        strWeights = Split(weight, ",")

        txtBox2.Text &= newWeight & vbCrLf
        txtBox2.Text &= strWeights.Length.ToString & vbCrLf
        txtBox2.Text &= "Tare: " & strWeights(1).ToString
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        SerialPort1.PortName = "COM5"
        SerialPort1.BaudRate = 9600
        SerialPort1.DataBits = 8
        SerialPort1.Parity = Parity.None
        SerialPort1.StopBits = StopBits.One
        SerialPort1.Handshake = Handshake.None
        SerialPort1.Open()

        SerialPort1.Write(vbCr)

    End Sub

If I can get it to work, I will have to incorporate it into my main program. I get the weight readings but gives an error when I press the Tare button on the indicator. Hope you can help. I got the manual but can't put a picture here. Hope you can help.
GeneralRe: Data string manipulation in VB 2010 Pin
Robert g Blair19-May-16 11:30
Robert g Blair19-May-16 11:30 
GeneralRe: Data string manipulation in VB 2010 Pin
Gus11319-May-16 22:41
Gus11319-May-16 22:41 
GeneralRe: Data string manipulation in VB 2010 Pin
Gus11319-May-16 23:33
Gus11319-May-16 23:33 
GeneralRe: Data string manipulation in VB 2010 Pin
Robert g Blair22-May-16 12:12
Robert g Blair22-May-16 12:12 
QuestionAdd unsubscribe link to header of the mail sent from outlook Pin
srikrishnathanthri11-May-16 20:15
srikrishnathanthri11-May-16 20:15 
AnswerRe: Add unsubscribe link to header of the mail sent from outlook Pin
Richard Deeming12-May-16 2:02
mveRichard Deeming12-May-16 2:02 
GeneralRe: Add unsubscribe link to header of the mail sent from outlook Pin
srikrishnathanthri12-May-16 2:38
srikrishnathanthri12-May-16 2:38 
GeneralRe: Add unsubscribe link to header of the mail sent from outlook Pin
Richard Deeming12-May-16 3:12
mveRichard Deeming12-May-16 3:12 
GeneralRe: Add unsubscribe link to header of the mail sent from outlook Pin
srikrishnathanthri12-May-16 3:23
srikrishnathanthri12-May-16 3:23 
QuestionSaving data with data-bound Form Controls Pin
Raabi Anony11-May-16 16:31
Raabi Anony11-May-16 16:31 
AnswerRe: Saving data with data-bound Form Controls Pin
Dave Kreskowiak12-May-16 1:15
mveDave Kreskowiak12-May-16 1:15 
GeneralRe: Saving data with data-bound Form Controls Pin
Raabi Anony12-May-16 16:48
Raabi Anony12-May-16 16:48 
QuestionThe ADO.NET provider with invariant name 'System.Data.SqlLite.EF6' is either not registered in the machine or application config file, Pin
jkirkerx10-May-16 14:16
professionaljkirkerx10-May-16 14:16 
Answer[100% Solved], How to get SQLite to work with vb.net and EF6 using the NuGet Package System.Data.SQLite (x86/x64) Pin
jkirkerx11-May-16 9:54
professionaljkirkerx11-May-16 9:54 
QuestionHow we can get last 12 months using current month using sql Pin
MANISHA SONAWANE9-May-16 20:39
MANISHA SONAWANE9-May-16 20:39 
AnswerRe: How we can get last 12 months using current month using sql Pin
Mycroft Holmes9-May-16 21:37
professionalMycroft Holmes9-May-16 21:37 
GeneralRe: How we can get last 12 months using current month using sql Pin
MANISHA SONAWANE10-May-16 0:02
MANISHA SONAWANE10-May-16 0:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.