منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : Add_Delete_Edit_Search_In_ListBox
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
بسم الله الرحمن الرحيم
السلام عليكم ورحمةالله وبركاته
بعد هذا الموضوع غارت الـListBox  وقالت لابد لي من موضوع فقلت ابشري(على اساس انها تخاطب كأنثىSmile)
ههههههههههههههههه
باين اني سويت المثال على استعجال من امري
في زر البحث  يوجد كود غير مناسب واضح طبعا.
PHP كود :
Public Class Form1
    Private Sub Btndel_Click
(sender As ObjectAs EventArgsHandles Btndel.Click
        If ListBox1
.SelectedIndex 0 Then Beep() : Exit Sub
        Dim index 
As Integer ListBox1.SelectedIndex
        ListBox1
.Items.RemoveAt(index)
 
   End Sub

    Private Sub Btnedit_Click
(sender As ObjectAs EventArgsHandles Btnedit.Click
        If ListBox1
.SelectedIndex 0 Then Beep() : Exit Sub
        If TextBox1
.Text.Trim "" Then Beep() : Exit Sub

        Dim index 
As Integer ListBox1.SelectedIndex
        ListBox1
.Items(index) = TextBox1.Text
    End Sub

    Private Sub Btnsearch_Click
(sender As ObjectAs EventArgsHandles Btnsearch.Click
        If ListBox1
.SelectedIndex 0 Then Beep() : Exit Sub
        Dim index 
As Integer ListBox1.FindString(TextBox1.Text)
 
       If index > -1 Then
            ListBox1
.SelectedIndex index
        Else
            MsgBox
("الاسم غير موجود"MsgBoxStyle.Information"")
 
       End If
 
   End Sub

    Private Sub BtnAdd_Click
(sender As ObjectAs EventArgsHandles BtnAdd.Click
        If TextBox1
.Text.Trim "" Then Beep() : Exit Sub
        If ListBox1
.FindString(TextBox1.Text) > -1 Then MsgBox("الاسم موجود"MsgBoxStyle.Information"") : TextBox1.Clear() : Exit Sub
        ListBox1
.Items.Add(TextBox1.Text)
 
       ListBox1.SelectedIndex = -1
        TextBox1
.Select()
 
       TextBox1.Focus()
 
       TextBox1.Clear()
 
   End Sub
End 
Class