Beispiel #1
0
        public static string GetColsName(DataGridView dataGridView1, string ColNums)
        {
            char [] separator = { ',' };
            //string是以逗号分隔的
            string[] AllNum = ColNums.Split(separator);
            //按照逗号分割
            string AllNames = "";

            foreach (string SingleNum in AllNum)
            {
                if (SingleNum != "")
                {
                    if (MathV.IsStringInt(SingleNum))
                    {
                        AllNames += dataGridView1.Columns[Convert.ToInt32(SingleNum) - 1].Name + ",";
                    }
                }
            }
            if (AllNames != "")
            {
                AllNames = AllNames.Substring(0, AllNames.Length - 1);
            }
            return(AllNames);
        }