I lang tid har samarbejdsbranchen fokuseret på at forbedre enhedsfunktioner – bedre kameraer, klarere lyd og smartere software. Men den virkelige forvandling handler ikke om funktioner.
Private Sub Form_Load() Dim i As Long Dim frmControl As Control For Each frmControl In Controls If TypeOf frmControl Is TextBox Then i = i + 1 frmControl.Text = CStr(i) End If Next End Sub
Private Sub Form_Load() Dim i As Long Dim strTxtName As String Dim frmControl As Control For Each frmControl In Controls If TypeOf frmControl Is TextBox Then strTxtName = Right(frmControl.Name, 1) frmControl.Text = strTxtName End If Next End Sub
Jeg har ikke helt fået løst problemet endnu, den kode jeg bruger er følgende
Sub BrugData() Dim L, L1, L2, L3, L4, L5, L6 'F1 = Linie1 - Routernavn 'F2 = Linie2 - PublicIP 'F3 = Linie3 - Gateway 'F4 = Linie4 - PrivatIP 'F5 = Linie5 - Sagsnr - SagsNavn 'F6 = Linie6 - RouterTest Dim F, F1, F2, F3, F4 'L1 = CheckFelt 'L2 = Text1 'L3 = Text2 'L4 = Text3 L = -5 L1 = -5 L2 = -4 L3 = -3 L4 = -2 L5 = -1 L6 = 0 Do While L <= y L = L + 6 L1 = L1 + 6 L2 = L2 + 6 L3 = L3 + 6 L4 = L4 + 6 L5 = L5 + 6 L6 = L6 + 6 Check1.Value = Linie(L6) '(Her skal jeg bruge loopen til at ændre Check1.value til Check2.value etc.) If Linie(L5) <> "" Then Check1.Caption = Linie(L1) & " - " & Linie(L5) Else Check1.Caption = "VPN Client bruges ikke" End If Text1 = Linie(L2) Text2 = Linie(L3) Text3 = Linie(L4) Loop End Sub
Jeg bruger den til et program som tester forbindelser til VPN clienter, jeg har ca. 200 linier oplysninger i Linie(X) som den skal indlæse i ca. 160 check og text boxe.
Private Sub Form_Load() ' 1 = Text1 Call SetTextBoxText("Test tekst.", 1) End Sub
Public Sub SetTextBoxText(ByVal strText As String, ByVal intNumber As Integer) Dim frmControl As Control For Each frmControl In Controls If TypeOf frmControl Is TextBox Then If Right(frmControl.Name, 1) = CStr(intNumber) Then frmControl.Text = strText Exit For End If End If Next End Sub
'SetCheckBox([Caption], [1 = Value (1 eller 0)], [Check xxxxxxx]) Call SetCheckBox("Test tekst.", 1, 1) End Sub
Public Sub SetTextBoxText(ByVal strText As String, ByVal intNumber As Integer) Dim frmControl As Control For Each frmControl In Controls If TypeOf frmControl Is TextBox Then If Right$(frmControl.Name, 1) = (intNumber) Then frmControl.Text = strText Exit For End If End If Next End Sub
Public Sub SetCheckBox(ByVal strText As String, ByVal intValue As Integer, ByVal intNumber As Integer) Dim frmControl As Control For Each frmControl In Controls If TypeOf frmControl Is CheckBox Then If Right$(frmControl.Name, 1) = (intNumber) Then frmControl.Value = intValue frmControl.Caption = strText Exit For End If End If Next End Sub
Private Sub Form_Load() Dim i As Long For i = 1 To 160 / 3 Call SetCheckBox("Test tekst.", 1, i) Call SetTextBoxText("Test tekst.", i) Call SetTextBoxText("Test tekst.", i + 1) Call SetTextBoxText("Test tekst.", i + 1) Next i End Sub
Call SetCheckBox(Linie(L1) & " - " & Linie(L5), Linie(L6), i) Call SetTextBoxText(Linie(L2), i) Call SetTextBoxText(Linie(L3), i + 1) Call SetTextBoxText(Linie(L4), i + 1) Next i End Sub
Det virkede ikke helt, men det gav mig noget at arbejde videre på.
Takker
/Tenere
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.