C#列数据、消息框messagebox、文本按指定长度自动换行

 public string dstotring(DataSet ds, int cursor)
        {

            if (ds.Tables[0].Rows.Count > 0)
            {
                int count = ds.Tables[0].Rows.Count;
                string Caption = string.Empty;
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < count; i++)
                {
                    sb.Append(ds.Tables[0].Rows[i][0].ToString()).Append(",");
                }
                Caption = sb.ToString();
                StringBuilder sb2 = new StringBuilder();
                for (int i = 0; i < Caption.Length; i += cursor)
                {
                    if (i + cursor > Caption.Length)
                    {
                        cursor = Caption.Length - i;
                        sb2.Append(Caption.Substring(i, cursor));
                    }
                    else
                    {
                        sb2.AppendLine(Caption.Substring(i, cursor));
                    }
                }
                return sb2.ToString();
            }
            return string.Empty;
        }