WinForms combobox with multiple columns (C#)?

前端 未结 11 2024
轮回少年
轮回少年 2020-12-01 21:19

I am using currently the following code to populate a combobox:

combobox.DataSource = datatable;
combobox.DisplayMember = \"Auftragsnummer\";
combobox.ValueM         


        
11条回答
  •  有刺的猬
    2020-12-01 21:38

    The full C# solution I provided for a Multicolumn Combo Box caused a problem when debugging in the app that used it. The problem was with the line "DateTime dt = DateTime.Parse(strColumnText);" in the method "IsDate" here is a new version of the method that uses DateTimeTryparse" instead: I have replaced the faulty version in the original. (N B For all its faults, it works!) cheers, Bruce Caldwell

         private bool IsDate(string strColumnText)
        {
            DateTime dateValue;
    
            if (DateTime.TryParse(strColumnText, out dateValue))
            {
                return true;
            }
            else
            {
                return false;
            }
        } // end sub
    

提交回复
热议问题