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

تحويل من c# إلى VB

مغلق
بدأه sarra في 14 أبريل 2006 · 2 رد · 501 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم...

ياليت القى كود مشابه للكود المرفق بـــ vb

 protected void Button1_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();
        foreach (GridViewRow row in GridView1.Rows)
        {
            int id = int.Parse(row.Cells[0].Text);
            CheckBox cb = (CheckBox)row.Cells[2].Controls[1];
            if (cb.Checked)
            {
                list.Add(id);
                SqlConnection conn = new SqlConnection(@"Data Source=ksu-0c1adb2d5b8\A;Initial Catalog =employee;Persist Security Info=True;User ID=sa;Password=sara");
                SqlCommand adapter = new SqlCommand("delete FROM Employee where id='" + id.ToString() + "'", conn);
                conn.Open();
                adapter.ExecuteNonQuery();
            }
        }

        TextBox1.Text = "";
        foreach (int x in list)
        {
            TextBox1.Text += x + "; ";
        }
    }
}

تم تعديل هذه المشاركة بواسطة محمد النحراوي في 14 أبريل 2006 في 22:05

#2

عسى هذا يساعد قليلاً

 Dim list As ArrayList =  New ArrayList() 
        Dim row As GridViewRow
        For Each row In GridView1.Rows
            Dim id As Integer =  Integer.Parse(row.Cells(0).Text) 
            Dim cb As CheckBox = CType(row.Cells(2).Controls(1), CheckBox)
            if cb.Checked then
            
                list.Add(id)
                Dim conn As SqlConnection =  New SqlConnection("Data Source=ksu-0c1adb2d5b8\A;Initial Catalog =employee;Persist Security Info=True;User ID=sa;Password=sara") 
                Dim adapter As SqlCommand =  New SqlCommand("delete FROM Employee where id='" + id.ToString() + "'",conn) 
                conn.Open()
                adapter.ExecuteNonQuery()
            end if
        Next

        TextBox1.Text = ""
        Dim x As Integer
        For Each x In list
            TextBox1.Text += x + "; "
        Next
#3

شكرا" جزيلا"

الله يجزاك خير اوخي

هذا الموضوع مغلق.

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