اذهب الي المحتوي
أوفيسنا

كيف اضيف شرط على كود الزمن


hh88

الردود الموصى بها

السلام عليكم ورحمة الله وبركاتة

اساتذتي الكرام

كيف اضيف شرط على الكود الزمن بحيث يكون

اذا كان ناتج مربع النص يساوي 1 يكون الوميض احمر

واذا كان ناتج مربع النص يساوي 2 يكون الوميض ازرق

الكود ادناه لايعمل بشكل صحيح بشرطين داحل مربع نص واحد 

Private Sub Form_Timer()

' اذا كان ناتج مربع النص هو 1 يكون الوميض احمر '
If Me![txtbox] = "1" Then

Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbRed, vbWhite, vbRed))

Else
Me.txtbox.ForeColor = RGB(0, 0, 0)
Me.txtbox.BackColor = RGB(255, 255, 255)

End If



'اذا كان ناتج مربع النص هو 2 يكون الوميض ازرق '
If Me![txtbox] = "2" Then


Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbBlue, vbWhite, vbBlue))


Else

Me.txtbox.ForeColor = RGB(0, 0, 0)
Me.txtbox.BackColor = RGB(255, 255, 255)


End If

end sub

 

رابط هذا التعليق
شارك

If Me![txtbox] = "1" Then
Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbRed, vbWhite, vbRed))
ElseIf Me![txtbox] = "2" Then
Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbBlue, vbWhite, vbBlue))
Else
Me.txtbox.ForeColor = RGB(0, 0, 0)
Me.txtbox.BackColor = RGB(255, 255, 255)
End If

 

  • Like 1
رابط هذا التعليق
شارك

On ‏٢٧‏/‏٠٤‏/‏١٤٣٩ at 1:23 PM, ابوخليل said:

If Me![txtbox] = "1" Then
Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbRed, vbWhite, vbRed))
ElseIf Me![txtbox] = "2" Then
Me.txtbox.BackColor = (IIf(Me.txtbox.BackColor = vbBlue, vbWhite, vbBlue))
Else
Me.txtbox.ForeColor = RGB(0, 0, 0)
Me.txtbox.BackColor = RGB(255, 255, 255)
End If

 

الف شكر استاذي الكريم ابا خليل

الله يعطيك العافية :fff:

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information