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.


Topics - 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
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

3
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

4
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

5
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

6
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]