tharwt قام بنشر يناير 13 قام بنشر يناير 13 (معدل) اريد ان اختصر هذا الكود فى سطر او سطرين او كما يتراء لخبراء المنتدى If Me.commanfaz = "منفذ1" Then Me.txt1.Visible = True Me.txtm1.Visible = True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Else Me.txt1.Visible = False Me.txtm1.Visible = False Me.txt2.Visible = False Me.txtm2.Visible = False Me.txt3.Visible = False Me.txtm3.Visible = False Me.txt4.Visible = False Me.txtm4.Visible = False Me.txt5.Visible = False Me.txtm5.Visible = False Me.txt6.Visible = False Me.txtm6.Visible = False Me.txt7.Visible = False Me.txtm7.Visible = False Me.txt8.Visible = False Me.txtm8.Visible = False Me.txtmst.Visible = False Me.txtstrorag.Visible = False If Me.commanfaz = "منفذ2" Then Me.txt2.Visible = True Me.txtm2.Visible = True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Else Me.txt1.Visible = False Me.txtm1.Visible = False Me.txt2.Visible = False Me.txtm2.Visible = False Me.txt3.Visible = False Me.txtm3.Visible = False Me.txt4.Visible = False Me.txtm4.Visible = False Me.txt5.Visible = False Me.txtm5.Visible = False Me.txt6.Visible = False Me.txtm6.Visible = False Me.txt7.Visible = False Me.txtm7.Visible = False Me.txt8.Visible = False Me.txtm8.Visible = False Me.txtmst.Visible = False Me.txtstrorag.Visible = False If Me.commanfaz = "منفذ3" Then Me.txt3.Visible = True Me.txtm3.Visible = True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Else Me.txt1.Visible = False Me.txtm1.Visible = False Me.txt2.Visible = False Me.txtm2.Visible = False Me.txt3.Visible = False Me.txtm3.Visible = False Me.txt4.Visible = False Me.txtm4.Visible = False Me.txt5.Visible = False Me.txtm5.Visible = False Me.txt6.Visible = False Me.txtm6.Visible = False Me.txt7.Visible = False Me.txtm7.Visible = False Me.txt8.Visible = False Me.txtm8.Visible = False Me.txtmst.Visible = False Me.txtstrorag.Visible = False end if end if end if تم تعديل يناير 13 بواسطه Moosak تنسيق الكود
Foksh قام بنشر يناير 13 قام بنشر يناير 13 سطر أو سطرين ، الله يسامحك 😅 اذا بالسطور تقدر تخليه سطر واحد وهو إنك تحط السطور جنب بعضها وتفصل بينهم بعلامة نقطتين : ، وإذا الفكرة بتغيير المنهج اللي انت متبعه ، فجرب هذا الكود Select Case Me.commanfaz Case "منفذ1" ShowControls True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Case "منفذ2" ShowControls True Me.txt2.Visible = True Me.txtm2.Visible = True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Case "منفذ3" ShowControls True Me.txt3.Visible = True Me.txtm3.Visible = True Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False Case Else ShowControls False End Select Sub ShowControls(visibility As Boolean) Me.txt1.Visible = visibility Me.txtm1.Visible = visibility Me.txt2.Visible = visibility Me.txtm2.Visible = visibility Me.txt3.Visible = visibility Me.txtm3.Visible = visibility Me.txt4.Visible = visibility Me.txtm4.Visible = visibility Me.txt5.Visible = visibility Me.txtm5.Visible = visibility Me.txt6.Visible = visibility Me.txtm6.Visible = visibility Me.txt7.Visible = visibility Me.txtm7.Visible = visibility Me.txt8.Visible = visibility Me.txtm8.Visible = visibility Me.txtmst.Visible = visibility Me.txtstrorag.Visible = visibility End Sub 1
Moosak قام بنشر يناير 13 قام بنشر يناير 13 وهذه محاولة لتقليص حجم الكود أيضا 🙂 Dim x As Integer For x = 1 To 8 Me("txt" & x).Visible = False Me("txtm" & x).Visible = False Next x Me.txtmst.Visible = False Me.txtstrorag.Visible = False Me.txtID.Enabled = False Me.txtitems.Enabled = False Me.txtmag.Enabled = False If Me.commanfaz = "منفذ1" Then Me.txt1.Visible = True Me.txtm1.Visible = True ElseIf Me.commanfaz = "منفذ2" Then Me.txt2.Visible = True Me.txtm2.Visible = True ElseIf Me.commanfaz = "منفذ3" Then Me.txt3.Visible = True Me.txtm3.Visible = True End If 1 1
tharwt قام بنشر يناير 20 الكاتب قام بنشر يناير 20 لكم جزيل الشكر والعرفان خاصه اخى الكريم Moosak على استجابتكم لى شكرا
الردود الموصى بها
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.