Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Padex

Pages: [1]
1
Open Discussion / Copy same value to another label text
« on: March 06, 2017, 10:58:32 PM »
Hi Guys,
Pls advice....
How to create vb code to copy label1 = label2, label2 = label3, label3=label4..... with difference value..
Fyi, label1 is data result.. this value always change after press enter button.
I need  copy like array index and publish in line chart
Example:
Current value
label1 = 0.001
label2 = 0.002
label3 = 0.003
label4 = 0.004

After push button enter
label1= 0.005
label2= 0.001
label3= 0.002
label4 = 0.003


2
Any Idea how to recognize com port 1 link with vb as well... how to switch handles by com1 scanner

3
Hi Guys,

How to lock text box by manual key in by keyboard and allow barcode scanner only.
this to prevent  of human error (typo).

I have no idea how to lock text box...
below is what i did.. but this will be lock once one number is fill in... any idea to delay for 1 sec then lock textbox or any step is more effective.

help me guys.... Im blur...

Code: [Select]
Private Sub Acu1PreCA1_ValueChanged(sender As Object, e As EventArgs) Handles Acu1PreCA1.TextChanged

        Acu1PreCA1.Text = CStr(Acu1PreCA1.Text)
        Try
            If Acu1PreCA1.Text = l Then
                MsgBox("Confirm Value")

                Acu1PreCA1.Enabled = False

            End If
        Catch ex As Exception

        End Try


    End Sub

4
Open Discussion / To filter data by date
« on: February 10, 2017, 03:59:01 AM »
Hi All,

Need your help... Im trying to filter my data based on SQLString but is not done well... catch all data... below is the code

Code: [Select]
Private Sub Show_Filter()
        Dim SQLString As String
        Dim Date1 As String
        Dim Date2 As String



        Date1 = DateFrom.Date & " 12:00:00 AM"
        Date2 = DateTo.Date & " 11:59:59 PM"


        TableName = "CAcpm"

        SQLString = "SELECT CAcpm.[No], CAcpm.Time, CAcpm.Date, CAcpm.[Pre CA], CAcpm.[Pos CA], CAcpm.[CA volume], CAcpm.Result, CAcpm.SKU, CAcpm.Remark, CAcpm.UserRec, CAcpm.[Vision Status], CAcpm.Station, CAcpm.UserIssue FROM " & TableName & " WHERE DateIn BETWEEN #" & Date1 & "# AND #" & Date2 & "#"


        ds.Clear()
        rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        rs.Open(SQLString, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

        da.Fill(ds, rs, TableName)

        DataGridView1.DataSource = ds.Tables(0)

    End Sub

5
Open Discussion / How to Decrease decimal digit
« on: January 24, 2017, 01:09:46 AM »
Hi All,

Based on code below, the calculation will give result display such 1.23456789000%. How to convert the decrease decimal become 1.23% only.

Please help... Thanks guys.

Code: [Select]
Private Sub RejectPercentage_ValueChanged(sender As Object, e As EventArgs) Handles RejectPercentage.TextChanged, TotalLabel.TextChanged, TextBox1.TextChanged
        Try
            RejectPercentage.Text = (CInt(TotalLabel.Text) / CInt(TextBox1.Text)) * 100
        Catch ex As Exception
        End Try
    End Sub

6
Open Discussion / Re: Unable to auto write boolean to force bit in PLC.
« on: January 18, 2017, 10:40:32 PM »
Fyi info, currently the code is function as what I need. Thanks for your help Godra...

This I share the code as below:

Code: [Select]
Private Sub BasicLabel1_ValueChanged(sender As Object, e As EventArgs) Handles Built1Label.ValueChanged, Built2Label.ValueChanged, TextBox1.TextChanged, TotalLabel.TextChanged
        Try
            ResultLabel.Text = (CInt(TextBox1.Text) + CInt(TotalLabel.Text)) - (CInt(Built1Label.Text) + CInt(Built2Label.Text))
            If CInt(ResultLabel.Text) = 10 Then
                BSA1.Write("_EXT_PC_Purge_On", CInt(True))
                BSA2.Write("_EXT_PC_Purge_On", CInt(True))

            End If
        Catch ex As Exception
        End Try

    End Sub

7
Open Discussion / Re: Unable to auto write boolean to force bit in PLC.
« on: January 18, 2017, 08:58:16 PM »
Mean do like this?


Code: [Select]
If CInt(ResultLabel.Text) = 10 Then
                PurgeBsa1.PLCAddressClick = AdvancedHMI.Controls.OutputType.Toggle
                PurgeBsa2.PLCAddressClick = AdvancedHMI.Controls.OutputType.Toggle
            End If

Testing already but not working... If assign .PerformClick() the form will be hanging and require to end task the program.

I have no idea now...

8
Open Discussion / Re: Unable to auto write boolean to force bit in PLC.
« on: January 18, 2017, 07:49:24 PM »
This is details:

I made counter in PLC to count qty balance to go. For example:
1) TextBox1.Text = 1000 pcs
2) ResultLabel.Text = (CInt(TextBox1.Text) + CInt(TotalLabel.Text)) - (CInt(Built1Label.Text) + CInt(Built2Label.Text))
3) FYI.. Built1Lable.Text and Built2Label.Text is value read counter from PLC.

So from step 1,2,3 above. I need to do automate function to stop the machine if ResultLabel.Text = 10 to force as True. Mean to ON tag bit I'm assign.

Below is vb I modify just now... I test run but not function.

 Private Sub BasicLabel1_ValueChanged(sender As Object, e As EventArgs) Handles Built1Label.ValueChanged, Built2Label.ValueChanged, PurgeBsa1.TextChanged, PurgeBsa2.TextChanged
        Try
            ResultLabel.Text = (CInt(TextBox1.Text) + CInt(TotalLabel.Text)) - (CInt(Built1Label.Text) + CInt(Built2Label.Text))
        Catch ex As Exception
        End Try

        Try
            If Not ResultLabel.Text = CInt(10) Then
                PurgeBsa1.OutputType = AdvancedHMI.Controls.OutputType.SetFalse
                PurgeBsa2.OutputType = AdvancedHMI.Controls.OutputType.SetFalse
            End If

            If ResultLabel.Text = CInt(10) Then
                PurgeBsa1.OutputType = AdvancedHMI.Controls.OutputType.SetTrue
                PurgeBsa2.OutputType = AdvancedHMI.Controls.OutputType.SetTrue
            End If
        Catch ex As Exception
        End Try
    End Sub


9
Open Discussion / Unable to auto write boolean to force bit in PLC.
« on: January 18, 2017, 04:36:05 AM »

Hi Guys,

Another help needed, I'm trying to do set auto toggle button = true (If ResultLabel.Text = 10) to force bit in PLC tag, but did not function as what I need. Still need perform manual click. I'm blurr...Pls help...Me TQ


Below is Vb.. I just try to created..


Private Sub PurgeBsa1_OutputType(sender As Object, e As EventArgs) Handles PurgeBsa1.TextChanged, PurgeBsa2.TextChanged

        Dim PurgeBsa1 = False
        Dim PurgeBsa2 = False

        Try
            ResultLabel.Text = 0

        Catch ex As Exception
        End Try
        If ResultLabel.Text = 10 Then
            PurgeBsa1 = True
            PurgeBsa2 = True
        End If
        BSA1.Write("_EXT_PC_Purge_On", CInt(ResultLabel.Text))
        BSA2.Write("_EXT_PC_Purge_On", CInt(ResultLabel.Text))
    End Sub

10
Open Discussion / Re: How to make value always update
« on: January 17, 2017, 07:19:21 PM »
Hi Archie,

The code is function well... thanks so much with your great answer and support....

11
Open Discussion / How to make value always update
« on: January 17, 2017, 01:22:59 AM »
Hi All,

I need your help to looking on my vb. Currently Im trying to calculate integer data from PLC and used vb to publish the result by button control.
But when I push the button only show the current value. How to make it button to always counting when the button push.

  Private Sub BasicButton1_Click(sender As Object, e As EventArgs) Handles BasicButton1.Click, BasicLabel298.Click
        Dim MyValue1 As Integer
        MyValue1 = BSA1.Read("Counter_Built_Out.acc")
        Dim MyValue2 As Integer
        MyValue2 = BSA2.Read("Counter_Built_Out.acc")
        Dim Built_plan As Integer = TextBox1.Text
        Dim Balance_built As Integer
        Balance_built = Built_plan - (MyValue1 + MyValue2)
        BasicLabel298.Text = Balance_built
    End Sub


Pages: [1]