ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
152
152
EMPFEHLEN
-
Moin Leute.
Bin gerade daran eine Wetterstation zu machen. Gewisse dinge werden Analog ausgelesen gewisse dinge Digital.
Bei den Digitalen eingängen muss ich das ganze Ja bit für Bit auswerten.
Hier mein kleiner VB-Code
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
Private Sub Command1_Click() 'Umwandlung in Binär Label10.Caption = DezBin(Text1.Text) 'Statusmonitor Dim lsText As String Dim liLaenge As Long Dim x As Integer Dim Status As String lsText = Label10.Caption liLaenge = Len(lsText) For x = 1 To liLaenge Status = "Shape" & x If CStr(Mid$(lsText, x, 1)) > 0 Then Form1.Status.FillColor = &HFF00& End If Next End Sub 'Funktion Binärumwandlung Private Function DezBin(Dez) As String Dim x As Integer If Dez >= 2 ^ 8 Then Call MsgBox("Zahl ist größer als 8 Bit") Exit Function End If Do If (Dez And 2 ^ x) Then DezBin = "1" & DezBin Else DezBin = "0" & DezBin End If x = x + 1 Loop Until 2 ^ x > Dez End Function
Zuerst wird die Funktion aufgegrufen um meine Zahl in das Binäre system umzuwandeln - und danach wird sie zerlegt.
Funktioniert soweit so gut alles - nur bei dem Teil hier komm ich nicht weiter.
Code :1 2 3 4
Status = "Shape" & x If CStr(Mid$(lsText, x, 1)) > 0 Then Form1.Status.FillColor = &HFF00& End If
Er gibt mir das "Status" bei Form1.Status als falsch aus. Was muss ich machen damit ich bei dem Form1......Fillcolor eine Variable benutzen kann? Oder muss ich das ganz anderst angehen?
Das ganze sollte bewirken das wenn
ich 1 = True bekomme in meinem Programm mein Shape grün gefärbt wird und bei 0 = Rot ( Dies ist nicht das Progi für die Wetterstation - just für den Statusmonitor
)
-
in Form 1 musst du nur die Property hinzufügen
BSP:
Code vb:1 2 3 4 5
Public Property Let MyFillColor(value As OLE_COLOR) Me.BackColor = value End Property
und natürlich auch die lesen Eigenschaft
Code vb:1 2 3 4
Public Property Get MyFillColor() As OLE_COLOR Me.BackColor = value End Property
Grüsse bbDon't get set into one form, adapt it and build your own, and let it grow, be like water. .... Now, water can flow or it can crash. Be water, my friend.
Ähnliche Themen
-
Kleines Variablenproblem
Von RaRu im Forum PHPAntworten: 3Letzter Beitrag: 15.11.09, 10:58 -
Variablenproblem
Von Lektor21 im Forum PHPAntworten: 14Letzter Beitrag: 18.09.07, 16:13 -
Rookie Variablenproblem
Von Backi im Forum Flash PlattformAntworten: 1Letzter Beitrag: 30.09.04, 11:59 -
Variablenproblem
Von MeyerChr im Forum PHPAntworten: 4Letzter Beitrag: 31.07.04, 14:25 -
Variablenproblem
Von Arndtinho im Forum PHPAntworten: 4Letzter Beitrag: 28.07.04, 14:12





Zitieren
Login





