السلام عليكم
1- اساتذتي الافاضل ممكن كود فيجول بيسك 2010
اضعه في بوتن يقوم بضرب ماموجود في TextBox1 في 12
ويضهر الناتج في TextBox2
ويعطي خطا اذا لم يكتب رقم في TextBox1
2- ممكن كود لـ TextBox يجعلها لا تكتب سوى ارقام اي لايقبل حروف
لكم مني جزيل الشكر
كود للارقام فقط
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Char.IsControl(e.KeyChar) = False Then
If Char.IsDigit(e.KeyChar) Then
Else
e.Handled = True
End If
End If
End Sub
كود
If TextBox1 .Text = "" Then
MsgBox("ينبغي ادخال رقم", MsgBoxStyle.Exclamation, "حقل اجبااري")
TextBox1 .Focus()
Exit Sub
Else
TextBox2.Text = TextBox1 .Text * 12
End If
(31-08-15, 02:57 PM)الطالب كتب : [ -> ]سلام
1:
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If IsNumeric(TextBox1.Text) Then
TextBox2.Text = Val(TextBox1.Text) * 12
Else
MsgBox("تاكد من الرقم")
End If
End Sub
2:
كود :
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not (Char.IsControl(e.KeyChar) Or Char.IsDigit(e.KeyChar)) Then e.Handled = True
End Sub
موفقين
لكم مني الف الف شكر .. لاهتمامكم..