09-08-22, 10:35 AM
السلام عليكم ورحمه الله وبركاته عايز كود جلب كل العلامات الخاصة والرموز الخاصه من الكيبورد يعني كل شي في الكيبورد عدا الارقام والحروف ؟
Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For i = 0 To 255
ListBox1.Items.Add(i)
ListBox2.Items.Add(Chr(i))
Next
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
ListBox2.SelectedIndex = ListBox1.SelectedIndex
End Sub
Private Sub ListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox2.SelectedIndexChanged
ListBox1.SelectedIndex = ListBox2.SelectedIndex
End Sub(09-08-22, 07:51 PM)Taha Okla كتب : [ -> ]افتح مشروع جديد وضع عليه
Listbox1
ListBox2
وفي قسم الاكواد ضع فيه الكود السابق ..
لما تشغل المشروع راح راح يحمل في اللست الاول أرقام من الصفر حتى 255
وفي اللست الثاني المحرف الخاص بكل حرف
عن طريق الدالة chr
فهي تأخذ الرقم من اللست الأول وتعطي محرفه في اللست الثاني.
Public Class Form1
Private Function isar(txt As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(txt, "[ء-ي]{1,}")
End Function
Private Function iseng(txt As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(txt, "[a-zA-Z]{1,}")
End Function
Private Sub w()
For i As Integer = 0 To 255
Dim c As Char = Chr(i)
If Char.IsLetter(c) And isar(c) = True Then
ListBox2.Items.Add(c)
ElseIf Char.IsLetter(c) And iseng(c) = True Then
ListBox1.Items.Add(c)
ElseIf Char.IsPunctuation(c) Then
ListBox3.Items.Add(c)
End If
Next
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
w()
lbleng.Text = ListBox1.Items.Count
lblar.Text = ListBox2.Items.Count
lbls.Text = ListBox3.Items.Count
End Sub
End Class
Private Sub w()
For i As Integer = 0 To 255
Dim c As Char = Chr(i)
If Char.IsLetter(c) And isar(c) = True Then
ListBox2.Items.Add(c)
ElseIf Char.IsLetter(c) And iseng(c) = True Then
ListBox1.Items.Add(c)
ElseIf Char.IsPunctuation(c) Then
ListBox3.Items.Add(c)
Else
ListBox4.Items.Add(c)
End If
Next
End Sub