Click here to Skip to main content
15,922,155 members
Home / Discussions / C#
   

C#

 
AnswerRe: Concatenation or Data Type problem :s Pin
Mbah Dhaim18-Sep-08 12:54
Mbah Dhaim18-Sep-08 12:54 
i've tried your code but no error found

here my code
private DataTable CreateDataTable()
        {
            DataTable result = new DataTable();
            result.Columns.AddRange(new DataColumn[]{new DataColumn("ID", typeof(int)), new DataColumn("NAME")});
            return result;
        }

        public List<string[]> CreateList()
        {
            List<string[]> result = new List<string[]>();
            for (int i = 0; i < 100; i++)
            {
                string[] data = new string[] { string.Format("{0}", i + 1), string.Format("data_{0}", i + 1) };
                result.Add(data);
            }
            return result;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dtb = CreateDataTable();
            List<string[]> result = CreateList();
            for (int i = 0; i < result.Count; i++)
            {
                dtb.Rows.Add(result[i]);
            }
            dataGridView1.DataSource = dtb;
            try
            {
                string strExpression = "ID = 1";
                DataRow[] dr = dtb.Select(strExpression);                 MessageBox.Show(dr[0].ToString());
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }


D'Oh! | :doh:

dhaim
programming is a hobby that make some money as side effect Smile | :)

GeneralRe: Concatenation or Data Type problem :s Pin
Muammar©18-Sep-08 23:06
Muammar©18-Sep-08 23:06 
QuestionProblems connecting to excel with c# 2005 over windows2000 Pin
R.A.C18-Sep-08 10:05
R.A.C18-Sep-08 10:05 
AnswerRe: Problems connecting to excel with c# 2005 over windows2000 Pin
Paul Conrad18-Sep-08 10:27
professionalPaul Conrad18-Sep-08 10:27 
GeneralRe: Problems connecting to excel with c# 2005 over windows2000 Pin
R.A.C18-Sep-08 12:10
R.A.C18-Sep-08 12:10 
GeneralRe: Problems connecting to excel with c# 2005 over windows2000 Pin
Paul Conrad18-Sep-08 12:20
professionalPaul Conrad18-Sep-08 12:20 
QuestionWho can help ? Pin
Mohammad Dayyan18-Sep-08 10:03
Mohammad Dayyan18-Sep-08 10:03 
AnswerRe: Who can help ? Pin
Giorgi Dalakishvili18-Sep-08 10:14
mentorGiorgi Dalakishvili18-Sep-08 10:14 
AnswerRe: Who can help ? Pin
Eslam Afifi18-Sep-08 15:15
Eslam Afifi18-Sep-08 15:15 
GeneralRe: Who can help ? Pin
Mohammad Dayyan19-Sep-08 2:25
Mohammad Dayyan19-Sep-08 2:25 
AnswerRe: Who can help ? Pin
Eslam Afifi19-Sep-08 4:12
Eslam Afifi19-Sep-08 4:12 
GeneralRe: Who can help ? Pin
Mohammad Dayyan19-Sep-08 4:31
Mohammad Dayyan19-Sep-08 4:31 
GeneralRe: Who can help ? Pin
Eslam Afifi19-Sep-08 5:53
Eslam Afifi19-Sep-08 5:53 
QuestionReliabilityContractAttribute Pin
HosamAly18-Sep-08 9:26
HosamAly18-Sep-08 9:26 
Questionhow to fire button1_click event while pressing enter key Pin
Shuaib wasif khan18-Sep-08 8:39
Shuaib wasif khan18-Sep-08 8:39 
AnswerRe: how to fire button1_click event while pressing enter key Pin
DaveyM6918-Sep-08 8:56
professionalDaveyM6918-Sep-08 8:56 
AnswerRe: how to fire button1_click event while pressing enter key Pin
Alan N18-Sep-08 8:58
Alan N18-Sep-08 8:58 
QuestionHow to convert an object array to string Pin
soniaiq18-Sep-08 7:32
soniaiq18-Sep-08 7:32 
AnswerRe: How to convert an object array to string Pin
DaveyM6918-Sep-08 7:37
professionalDaveyM6918-Sep-08 7:37 
GeneralRe: How to convert an object array to string Pin
soniaiq18-Sep-08 7:47
soniaiq18-Sep-08 7:47 
GeneralRe: How to convert an object array to string Pin
DaveyM6918-Sep-08 8:34
professionalDaveyM6918-Sep-08 8:34 
GeneralRe: How to convert an object array to string Pin
srabik18-Sep-08 13:18
srabik18-Sep-08 13:18 
AnswerRe: How to convert an object array to string Pin
Paul Conrad18-Sep-08 7:46
professionalPaul Conrad18-Sep-08 7:46 
Question[Message Deleted] Pin
soniaiq18-Sep-08 7:59
soniaiq18-Sep-08 7:59 
AnswerRe: How to convert an object array to string Pin
Paul Conrad18-Sep-08 8:04
professionalPaul Conrad18-Sep-08 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.