الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

تحكم فى ال Inputbox كما تريد

بدأه njd في 25 يناير 2008 · 5 رد · 1,185 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الأخوه والأخوات أعضاء المنتدى الأعزاء

سألنى صديق عن التحكم فى ال InputBox وذلك بتشفيره لأنه كان بريد ان يستخدمه

فى أدخال كلمة سر

ولم أجد خصائص له لذلك صممت هذا InputBox لصديقى ورأيت ان أضعه هنا

ليستفيد منه الجميع أذا دعت الحاجه له

مرفق مثال التصميم

أرجوا التعقيب من المشرفين والأعضاء

InputBox.rar

كل من فى الوجود يطلب صيداً :::: غير ان الشباك مختلفات

#2

الاخ الكريم تلميح مليح .. اعجبني الاخفاء .. ولكن لم يظهر تأثير عندما جربت الحروف الكبيرة والصغيرة ففي الحالتين لم يطرأ تغيير

فلسطين الزاهية بألوان الحب والسلام

ذلك الطعم الزيتوني الذي يتدفق عسلاً من أفواه بساتينها وحدائقها

تشتاق إليها نفوس المتقين وترنوا للسجود فيها جباه المسلمين

#3

اشكرك أخى على تعقيبك الحروف الكبيرة والصغيرة فى اللغة الأنجليزية فقط آى

CAPITAL Or small

كل من فى الوجود يطلب صيداً :::: غير ان الشباك مختلفات

#4

السلام عليكم,

تعديل بسيط علي الكود

Imports System.Drawing
 Imports System.Windows.Forms
 Public Class InPutBox

	 Shared data As String = Nothing
	 Shared dataDefault As String = Nothing

	 Public Shared Shadows Function Show(ByVal Title As String, _
										 ByVal Message As String) As String
		 Return Show(Title, Message, Nothing, Nothing, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
										 ByVal Message As String, _
										 ByVal defaultValue As String) As String
		 Return Show(Title, Message, defaultValue, Nothing, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String) As String
		 Return Show(Title, Message, defaultValue, SpacialChr, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String, _
											ByVal Casing As CharacterCasing) As String
		 Return Show(Title, Message, defaultValue, SpacialChr, Casing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String, _
											ByVal Casing As CharacterCasing, _
											ByVal BackColor As Color, _
											ByVal ForeColor As Color, _
											ByVal FrmBackColor As Color, _
											ByVal FrmForeColor As Color) As String

		 Dim codeInt As Integer
		 Dim Value As String = ""

		 Using frm As New InPutBox
			 If Trim(Title) = "" Then
				 Title = "InputBox Demo by Ashraf Abouldahab"
			 End If
			 If Not SpacialChr = Nothing And Trim(SpacialChr) <> "" Then
				 codeInt = Asc(SpacialChr)
				 frm.TextBox1.PasswordChar = Chr(codeInt) 'Chr(42)
			 End If
			 ' Character Casing
			 Select Case Casing
				 Case CharacterCasing.Upper
					 frm.TextBox1.CharacterCasing = CharacterCasing.Upper
				 Case CharacterCasing.Lower
					 frm.TextBox1.CharacterCasing = CharacterCasing.Lower
				 Case Else
					 frm.TextBox1.CharacterCasing = CharacterCasing.Normal
			 End Select
			 ' TextBox Color
			 If BackColor <> Color.Empty Then
				 frm.TextBox1.BackColor = BackColor
			 Else
				 frm.TextBox1.BackColor = System.Drawing.Color.White
			 End If

			 If ForeColor = Color.Empty Then
				 frm.TextBox1.ForeColor = ForeColor
			 Else
				 frm.TextBox1.ForeColor = System.Drawing.Color.Black
			 End If
			 'Form Color
			 If FrmBackColor = Color.Empty Then
				 frm.BackColor = FrmBackColor
			 Else
				 frm.BackColor = System.Drawing.SystemColors.Control
			 End If

			 If FrmForeColor = Color.Empty Then
				 frm.ForeColor = FrmForeColor
			 Else
				 frm.ForeColor = System.Drawing.Color.Black
			 End If

			 frm.Text = Title
			 frm.Label1.Text = Message
			 dataDefault = defaultValue
			 frm.ShowDialog()
			 Return data
		 End Using

	 End Function

	 Private Sub CmdOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdOk.Click
		 If (TextBox1.Text.Length > 0) Then
			 data = TextBox1.Text
		 ElseIf ((dataDefault IsNot Nothing) AndAlso (dataDefault.Length > 0)) Then
			 data = dataDefault
		 End If
		 Me.Close()
	 End Sub

	 Private Sub CmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdCancel.Click
		 data = ""
		 dataDefault = ""
		 Me.Close()
	 End Sub
 End Class

وينادي هكذا

TextBox1.Text = InPutBox.Show("InputBox Demo", "Fill Text", "this is a default value")

InputBox.zip

مواضيع متنوعة

#5

الاخ Mouday

أشكرك على هذا التعقيب كود ممتاز بس طويل المهم ان فى النهاية الهدف واحد

كل من فى الوجود يطلب صيداً :::: غير ان الشباك مختلفات

#6
Moudey كتب:
السلام عليكم,

تعديل بسيط علي الكود

Imports System.Drawing
Imports System.Windows.Forms
Public Class InPutBox

	 Shared data As String = Nothing
	 Shared dataDefault As String = Nothing

	 Public Shared Shadows Function Show(ByVal Title As String, _
										 ByVal Message As String) As String
		 Return Show(Title, Message, Nothing, Nothing, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
										 ByVal Message As String, _
										 ByVal defaultValue As String) As String
		 Return Show(Title, Message, defaultValue, Nothing, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String) As String
		 Return Show(Title, Message, defaultValue, SpacialChr, Nothing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String, _
											ByVal Casing As CharacterCasing) As String
		 Return Show(Title, Message, defaultValue, SpacialChr, Casing, Color.Empty, Color.Empty, Color.Empty, Color.Empty)
	 End Function

	 Public Shared Shadows Function Show(ByVal Title As String, _
											ByVal Message As String, _
											ByVal defaultValue As String, _
											ByVal SpacialChr As String, _
											ByVal Casing As CharacterCasing, _
											ByVal BackColor As Color, _
											ByVal ForeColor As Color, _
											ByVal FrmBackColor As Color, _
											ByVal FrmForeColor As Color) As String

		 Dim codeInt As Integer
		 Dim Value As String = ""

		 Using frm As New InPutBox
			 If Trim(Title) = "" Then
				 Title = "InputBox Demo by Ashraf Abouldahab"
			 End If
			 If Not SpacialChr = Nothing And Trim(SpacialChr) <> "" Then
				 codeInt = Asc(SpacialChr)
				 frm.TextBox1.PasswordChar = Chr(codeInt) 'Chr(42)
			 End If
			 ' Character Casing
			 Select Case Casing
				 Case CharacterCasing.Upper
					 frm.TextBox1.CharacterCasing = CharacterCasing.Upper
				 Case CharacterCasing.Lower
					 frm.TextBox1.CharacterCasing = CharacterCasing.Lower
				 Case Else
					 frm.TextBox1.CharacterCasing = CharacterCasing.Normal
			 End Select
			 ' TextBox Color
			 If BackColor <> Color.Empty Then
				 frm.TextBox1.BackColor = BackColor
			 Else
				 frm.TextBox1.BackColor = System.Drawing.Color.White
			 End If

			 If ForeColor = Color.Empty Then
				 frm.TextBox1.ForeColor = ForeColor
			 Else
				 frm.TextBox1.ForeColor = System.Drawing.Color.Black
			 End If
			 'Form Color
			 If FrmBackColor = Color.Empty Then
				 frm.BackColor = FrmBackColor
			 Else
				 frm.BackColor = System.Drawing.SystemColors.Control
			 End If

			 If FrmForeColor = Color.Empty Then
				 frm.ForeColor = FrmForeColor
			 Else
				 frm.ForeColor = System.Drawing.Color.Black
			 End If

			 frm.Text = Title
			 frm.Label1.Text = Message
			 dataDefault = defaultValue
			 frm.ShowDialog()
			 Return data
		 End Using

	 End Function

	 Private Sub CmdOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdOk.Click
		 If (TextBox1.Text.Length > 0) Then
			 data = TextBox1.Text
		 ElseIf ((dataDefault IsNot Nothing) AndAlso (dataDefault.Length > 0)) Then
			 data = dataDefault
		 End If
		 Me.Close()
	 End Sub

	 Private Sub CmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdCancel.Click
		 data = ""
		 dataDefault = ""
		 Me.Close()
	 End Sub
End Class

وينادي هكذا

TextBox1.Text = InPutBox.Show("InputBox Demo", "Fill Text", "this is a default value")

InputBox.zip

الأخ/mouday شكراً على هذا التعقيب وجعله الله في ميزان حسناتك

مواضيع مشابهة