تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[C#.NET] استفسار
#1
السلام عليكم ورحمة الله وبركاته
الرجاء من اخوة خبراء بالمنتدي اجابتي 
لاريد كتابة كل مره combobox في دالة بمعني مره اول مره ثاني مره ثالت 
اريد combobox واحد فقط هل من حل منطقي او لا يوجد حل   
اريد فقط في استدعاء استدعي الذي اريد تعبئته فقط           
PHP كود :
public partial class Form1 Form
    
{
 
       public void fill_combobox(string sql,string col_name)
 
       {
 
           comboBox1.Items.Clear();
 
           comboBox2.Items.Clear();
 
           DataTable dt = new DataTable();
 
           SqlDataAdapter adp = new SqlDataAdapter(sqlClass1.con);
 
           adp.Fill(dt);
 
           for (int i 0<= dt.Rows.Count 1i++)
 
           {
 
               comboBox1.Items.Add(dt.Rows[i][col_name]);
 
               comboBox2.Items.Add(dt.Rows[i][col_name]);

 
           }
 
       }
 
       public Form1()
 
       {
 
           InitializeComponent();
 
       }

 
       private void Form1_Load(object senderEventArgs e)
 
       {
 
           fill_combobox("select *from ItemNameTable""ItemName");
 
           fill_combobox("select *from ItemCategoryTable""CategoryName");

 
       }

 
       private void comboBox1_DropDown(object senderEventArgs e)
 
       {
 
           fill_combobox("select *from ItemCategoryTable""CategoryName");
 
       }

 
       private void comboBox2_DropDown(object senderEventArgs e)
 
       {
 
           fill_combobox("select *from ItemNameTable""ItemName");

 
       }
 
   
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
استفسار - بواسطة ahmed_king2023 - 05-05-23, 03:59 PM
RE: استفسار - بواسطة ramy alfoly - 05-05-23, 04:37 PM
RE: استفسار - بواسطة ahmed_king2023 - 05-05-23, 07:01 PM
RE: استفسار - بواسطة ramy alfoly - 05-05-23, 07:31 PM


التنقل السريع :


يقوم بقرائة الموضوع: