Matrice di controlli textbox non visualizzano niente

di il
5 risposte

Matrice di controlli textbox non visualizzano niente

Come da titolo niente viene visualizzato nelle textbox, qualche idea ?

    For r = 1 To btor / 2
        value = 256
        value = value * arr(r * 2 + 1)
        value = value + arr(r * 2 + 2)
        BCSETPOINT(r) = value
        Select Case r
        Case 1
        Me.Text1(0).Text = Format(BCSETPOINT(r), "00000")
        Case 2
        Me.Text1(1).Text = Format(BCSETPOINT(r), "00000")
        Case 3
        Me.Text1(2).Text = Format(BCSETPOINT(r), "00000")
        Case 4
        Me.Text1(3).Text = Format(BCSETPOINT(r), "00000")
        Case 5
        Me.Text1(4).Text = Format(BCSETPOINT(r), "00000")
        Case 6
        Me.Text1(5).Text = Format(BCSETPOINT(r), "00000")
        End Select
    Next r

5 Risposte

  • Re: Matrice di controlli textbox non visualizzano niente

    Ho provato ad utilizzare le label anche queste in matrice e funzionano

    non funzionano le textbox non ne riesco a capire il motivo

    questa la maschera

    le label sono state impostate nel codice correttamente le test box sono rimaste vuote come si vede

    Private Sub Form_Load()
    
    For r = 1 To 6
        Me.Label1(r - 1).Caption = BCSetReg(r)
    Next r
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
    Form1.SetFocus
    Form1.Timer1.Enabled = True
    Form1.MSComm3.PortOpen = True
    
    End Sub
    
    Private Sub Leggi_Click()
    Dim buffer As Variant
    Dim arr() As Byte
    Dim setpoint(6) As Long
    
    Call modbus2(255, 3, 0, 18, 0, 6)
    
    Lenght = 6 * 2 + 5
    Form1.MSComm2.InputLen = Lenght
    While Form1.MSComm2.InBufferCount < Lenght
    Wend
    
    buffer = Form1.MSComm2.Input
    arr = buffer
    
    For x = 1 To Lenght
        bufrc2(x - 1) = arr(x - 1)
    Next x
    
    mycrc = calccrc2(Lenght, 1)
    
    crcl = arr(Lenght - 2)
    crch = arr(Lenght - 1)
    
    node = arr(0)
    func = arr(1)
    btor = arr(2)
    
    If ((crcl = crcl2) And (crch = crch2)) Then
        For r = 1 To btor / 2
            value = 256
            value = value * arr(r * 2 + 1)
            value = value + arr(r * 2 + 2)
            BCSETPOINT(r) = value
            Me.Text1(r - 1).Enabled = True
            Me.Text1(r - 1).Text = Format(BCSETPOINT(r), "00000")
            Me.Text1(r - 1).Visible = True
        Next r
    Else
        response = MsgBox("MODBUS CRC16 ERROR", vbOKOnly)
    End If
    
    For r = 1 To 5
        setpoint(r - 1) = BCSETPOINT(r)
    Next r
    
    mycrc = calccrc(5, setpoint())
    
    If mycrc <> BCSETPOINT(6) Then
        response = MsgBox("SETPOINT CRC16 ERROR", vbOKOnly)
    Else
        response = MsgBox("SETPOINT CRC16 OK", vbOKOnly)
    End If
    
    End Sub
    
  • Re: Matrice di controlli textbox non visualizzano niente

    Ho provato un' altra form che dovevo creare con 47 controlli textbox

    e questa funziona ... proverò ad eliminare text1 sulla form2 e ricreare 

    tutte le textbox per vedere se funzionano

    Private Sub Form_Load()
    
    For r = 1 To 47
        Me.Label1(r - 1).Caption = MAINSetReg(r)
    Next r
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
    Form1.SetFocus
    Form1.Timer1.Enabled = True
    Form1.MSComm3.PortOpen = True
    
    End Sub
    
    Private Sub Leggi_Click()
    
    For r = 1 To 47
        Me.Text1(r - 1).Text = Format(r, "00")
    Next r
    
    End Sub
    
    Private Sub Scrivi_Click()
    
    For r = 1 To 47
        Me.Text1(r - 1).Text = Format(r, "00")
    Next r
    
    End Sub
  • Re: Matrice di controlli textbox non visualizzano niente

    Ho eliminato tutti i textbox1 e li ho ricreati ex novo e tutto funziona !!!

    Private Sub Form_Load()
    
    For r = 1 To 6
        Me.Label1(r - 1).Caption = BCSetReg(r)
    Next r
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
    Form1.SetFocus
    Form1.Timer1.Enabled = True
    Form1.MSComm3.PortOpen = True
    
    End Sub
    
    Private Sub Leggi_Click()
    Dim buffer As Variant
    Dim arr() As Byte
    Dim setpoint(6) As Long
    
    Call modbus2(255, 3, 0, 18, 0, 6)
    
    Lenght = 6 * 2 + 5
    Form1.MSComm2.InputLen = Lenght
    While Form1.MSComm2.InBufferCount < Lenght
    Wend
    
    buffer = Form1.MSComm2.Input
    arr = buffer
    
    For x = 1 To Lenght
        bufrc2(x - 1) = arr(x - 1)
    Next x
    
    mycrc = calccrc2(Lenght, 1)
    
    crcl = arr(Lenght - 2)
    crch = arr(Lenght - 1)
    
    node = arr(0)
    func = arr(1)
    btor = arr(2)
    
    If ((crcl = crcl2) And (crch = crch2)) Then
        For r = 1 To btor / 2
            value = 256
            value = value * arr(r * 2 + 1)
            value = value + arr(r * 2 + 2)
            BCSETPOINT(r) = value
            Me.Text1(r - 1).Text = Format(BCSETPOINT(r), "00000")
        Next r
    Else
        response = MsgBox("MODBUS CRC16 ERROR", vbOKOnly)
    End If
    
    For r = 1 To 5
        setpoint(r - 1) = BCSETPOINT(r)
    Next r
    
    mycrc = calccrc(5, setpoint())
    
    If mycrc <> BCSETPOINT(6) Then
        response = MsgBox("SETPOINT CRC16 ERROR", vbOKOnly)
    Else
        response = MsgBox("SETPOINT CRC16 OK", vbOKOnly)
    End If
    
    End Sub
    
  • Re: Matrice di controlli textbox non visualizzano niente

    Ti sei fatto delle domande e ti sei dato delle risposte...

    sicuro che le text box non siano con testo bianco su fondo bianco? parlo della prima schermata...

  • Re: Matrice di controlli textbox non visualizzano niente

    Non so forse lo erano ma ormai non ho modo di controllare

    perchè come detto ho eliminato e ricreato la matrice di textbox

Devi accedere o registrarti per scrivere nel forum
5 risposte