How to generate datagrid without knowing # of rows (not retrieving form a database)

Discussion in 'ASP .Net Datagrid Control' started by Hai Nguyen, Jan 15, 2004.

  1. Hai Nguyen

    Hai Nguyen Guest

    Hi all

    I'm trying to create form (can be anything, but a prefer it's a datagrid).
    It should look like this

    Header 1 Header 2 Header3 Header4 Header5
    (textbox) (textbox) (textbox) (textbox)
    (textbox)
    (textbox) (textbox) (textbox) (textbox)
    (textbox)
    (textbox) (textbox) (textbox) (textbox)
    (textbox)
    (textbox) (textbox) (textbox) (textbox)
    (textbox)


    My question is:
    1/ Since I don't know the number of row in advance, if I'm still be able to
    generate datagrid with a particular number of row (let's say 10 rows)

    2/ Because the header is stored in a ArrayList, how do i bind those to the
    header

    3/ After user fills out those textbox, I need to insert those infos to
    database, how can I do that?

    4/ If users want to insert more than the rows printing, how can they add
    more rows?

    I appreciate any idea to get this problem solve.

    PS: If we can n't solve in datagrid, any solutions will be my big help

    Thanks everyone
    Hai Nguyen, Jan 15, 2004
    #1
    1. Advertising

  2. Hai Nguyen

    Alvin Bruney Guest

    What you would need to do is build a datagrid manually one row at a time as
    needed. When you construct a row, you will set the caption name and the
    value items as you go along. This code creates 4 column datagrid. then adds
    rows to it as needed

    DataSet dsTemp = new DataSet();

    DataTable Tables = new DataTable();

    dsTemp.Tables.Add(Tables);

    dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );

    dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
    "System.Double" ) );

    dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType(
    "System.Double" ) );

    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("dddd
    MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );

    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("dddd
    MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );

    for(int col = 0; col < ds.Tables[0].Columns.Count; col++)

    {

    DataRow myRow = dsTemp.Tables[0].NewRow();

    myRow[4]= 0.00;

    if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))

    myRow[4]= input.ToString();


    myRow[3]= 0.00;

    if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))

    myRow[3]= input.ToString();


    if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    Double.Parse(myRow[4].ToString())).ToString(),
    System.Globalization.NumberStyles.Any,
    System.Globalization.NumberFormatInfo.InvariantInfo, out input))

    myRow[2]= input.ToString();

    if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)

    myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);


    myRow[0]= ds.Tables[0].Columns[col].ColumnName;

    dsTemp.Tables[0].Rows.Add(myRow);

    }

    Feel free to modify the code as you see fit.

    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "Hai Nguyen" <> wrote in message
    news:%...
    > Hi all
    >
    > I'm trying to create form (can be anything, but a prefer it's a datagrid).
    > It should look like this
    >
    > Header 1 Header 2 Header3 Header4 Header5
    > (textbox) (textbox) (textbox) (textbox)
    > (textbox)
    > (textbox) (textbox) (textbox) (textbox)
    > (textbox)
    > (textbox) (textbox) (textbox) (textbox)
    > (textbox)
    > (textbox) (textbox) (textbox) (textbox)
    > (textbox)
    >
    >
    > My question is:
    > 1/ Since I don't know the number of row in advance, if I'm still be able

    to
    > generate datagrid with a particular number of row (let's say 10 rows)
    >
    > 2/ Because the header is stored in a ArrayList, how do i bind those to the
    > header
    >
    > 3/ After user fills out those textbox, I need to insert those infos to
    > database, how can I do that?
    >
    > 4/ If users want to insert more than the rows printing, how can they add
    > more rows?
    >
    > I appreciate any idea to get this problem solve.
    >
    > PS: If we can n't solve in datagrid, any solutions will be my big help
    >
    > Thanks everyone
    >
    >
    >
    >
    Alvin Bruney, Jan 15, 2004
    #2
    1. Advertising

  3. Hai Nguyen

    Hai Nguyen Guest

    I'm sorry for asking you dump question. There are some part of your code I don't understand. Would you please feel free to explain it to me


    dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType( "System.Double" ) );
    dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType("System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("ddddMM/dd/yyyy"), System.Type.GetType"System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("ddddMM/dd/yyyy"), System.Type.GetType ("System.Double" ) );

    What does it mean?

    Thanks


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:%23FW%23z%...
    > What you would need to do is build a datagrid manually one row at a time as
    > needed. When you construct a row, you will set the caption name and the
    > value items as you go along. This code creates 4 column datagrid. then adds
    > rows to it as needed
    >
    > DataSet dsTemp = new DataSet();
    >
    > DataTable Tables = new DataTable();
    >
    > dsTemp.Tables.Add(Tables);
    >
    > dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
    >
    > {
    >
    > DataRow myRow = dsTemp.Tables[0].NewRow();
    >
    > myRow[4]= 0.00;
    >
    > if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[4]= input.ToString();
    >
    >
    > myRow[3]= 0.00;
    >
    > if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[3]= input.ToString();
    >
    >
    > if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    > Double.Parse(myRow[4].ToString())).ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[2]= input.ToString();
    >
    > if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)
    >
    > myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    > Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);
    >
    >
    > myRow[0]= ds.Tables[0].Columns[col].ColumnName;
    >
    > dsTemp.Tables[0].Rows.Add(myRow);
    >
    > }
    >
    > Feel free to modify the code as you see fit.
    >
    > --
    > Regards,
    > Alvin Bruney
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "Hai Nguyen" <> wrote in message
    > news:%...
    > > Hi all
    > >
    > > I'm trying to create form (can be anything, but a prefer it's a datagrid).
    > > It should look like this
    > >
    > > Header 1 Header 2 Header3 Header4 Header5
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > >
    > >
    > > My question is:
    > > 1/ Since I don't know the number of row in advance, if I'm still be able

    > to
    > > generate datagrid with a particular number of row (let's say 10 rows)
    > >
    > > 2/ Because the header is stored in a ArrayList, how do i bind those to the
    > > header
    > >
    > > 3/ After user fills out those textbox, I need to insert those infos to
    > > database, how can I do that?
    > >
    > > 4/ If users want to insert more than the rows printing, how can they add
    > > more rows?
    > >
    > > I appreciate any idea to get this problem solve.
    > >
    > > PS: If we can n't solve in datagrid, any solutions will be my big help
    > >
    > > Thanks everyone
    > >
    > >
    > >
    > >

    >
    >
    Hai Nguyen, Jan 15, 2004
    #3
  4. Hai Nguyen

    Alvin Bruney Guest

    this builds a grid like so
    % variance raw variance Wednesday 01/14/2004 Wednesday 01/07/2004


    then you build the rows to fill out the grid. Make sense?

    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "Hai Nguyen" <> wrote in message news:%...
    I'm sorry for asking you dump question. There are some part of your code I don't understand. Would you please feel free to explain it to me


    dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType( "System.Double" ) );
    dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType("System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("ddddMM/dd/yyyy"), System.Type.GetType"System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("ddddMM/dd/yyyy"), System.Type.GetType ("System.Double" ) );

    What does it mean?

    Thanks


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:%23FW%23z%...
    > What you would need to do is build a datagrid manually one row at a time as
    > needed. When you construct a row, you will set the caption name and the
    > value items as you go along. This code creates 4 column datagrid. then adds
    > rows to it as needed
    >
    > DataSet dsTemp = new DataSet();
    >
    > DataTable Tables = new DataTable();
    >
    > dsTemp.Tables.Add(Tables);
    >
    > dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
    >
    > {
    >
    > DataRow myRow = dsTemp.Tables[0].NewRow();
    >
    > myRow[4]= 0.00;
    >
    > if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[4]= input.ToString();
    >
    >
    > myRow[3]= 0.00;
    >
    > if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[3]= input.ToString();
    >
    >
    > if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    > Double.Parse(myRow[4].ToString())).ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[2]= input.ToString();
    >
    > if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)
    >
    > myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    > Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);
    >
    >
    > myRow[0]= ds.Tables[0].Columns[col].ColumnName;
    >
    > dsTemp.Tables[0].Rows.Add(myRow);
    >
    > }
    >
    > Feel free to modify the code as you see fit.
    >
    > --
    > Regards,
    > Alvin Bruney
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "Hai Nguyen" <> wrote in message
    > news:%...
    > > Hi all
    > >
    > > I'm trying to create form (can be anything, but a prefer it's a datagrid).
    > > It should look like this
    > >
    > > Header 1 Header 2 Header3 Header4 Header5
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > >
    > >
    > > My question is:
    > > 1/ Since I don't know the number of row in advance, if I'm still be able

    > to
    > > generate datagrid with a particular number of row (let's say 10 rows)
    > >
    > > 2/ Because the header is stored in a ArrayList, how do i bind those to the
    > > header
    > >
    > > 3/ After user fills out those textbox, I need to insert those infos to
    > > database, how can I do that?
    > >
    > > 4/ If users want to insert more than the rows printing, how can they add
    > > more rows?
    > >
    > > I appreciate any idea to get this problem solve.
    > >
    > > PS: If we can n't solve in datagrid, any solutions will be my big help
    > >
    > > Thanks everyone
    > >
    > >
    > >
    > >

    >
    >
    Alvin Bruney, Jan 15, 2004
    #4
  5. Hai Nguyen

    Hai Nguyen Guest

    Thank you Alvin, you are awesome


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:...
    this builds a grid like so
    % variance raw variance Wednesday 01/14/2004 Wednesday 01/07/2004


    then you build the rows to fill out the grid. Make sense?

    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "Hai Nguyen" <> wrote in message news:%...
    I'm sorry for asking you dump question. There are some part of your code I don't understand. Would you please feel free to explain it to me


    dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType( "System.Double" ) );
    dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType("System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("ddddMM/dd/yyyy"), System.Type.GetType"System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("ddddMM/dd/yyyy"), System.Type.GetType ("System.Double" ) );

    What does it mean?

    Thanks


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:%23FW%23z%...
    > What you would need to do is build a datagrid manually one row at a time as
    > needed. When you construct a row, you will set the caption name and the
    > value items as you go along. This code creates 4 column datagrid. then adds
    > rows to it as needed
    >
    > DataSet dsTemp = new DataSet();
    >
    > DataTable Tables = new DataTable();
    >
    > dsTemp.Tables.Add(Tables);
    >
    > dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
    >
    > {
    >
    > DataRow myRow = dsTemp.Tables[0].NewRow();
    >
    > myRow[4]= 0.00;
    >
    > if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[4]= input.ToString();
    >
    >
    > myRow[3]= 0.00;
    >
    > if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[3]= input.ToString();
    >
    >
    > if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    > Double.Parse(myRow[4].ToString())).ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[2]= input.ToString();
    >
    > if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)
    >
    > myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    > Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);
    >
    >
    > myRow[0]= ds.Tables[0].Columns[col].ColumnName;
    >
    > dsTemp.Tables[0].Rows.Add(myRow);
    >
    > }
    >
    > Feel free to modify the code as you see fit.
    >
    > --
    > Regards,
    > Alvin Bruney
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "Hai Nguyen" <> wrote in message
    > news:%...
    > > Hi all
    > >
    > > I'm trying to create form (can be anything, but a prefer it's a datagrid).
    > > It should look like this
    > >
    > > Header 1 Header 2 Header3 Header4 Header5
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > >
    > >
    > > My question is:
    > > 1/ Since I don't know the number of row in advance, if I'm still be able

    > to
    > > generate datagrid with a particular number of row (let's say 10 rows)
    > >
    > > 2/ Because the header is stored in a ArrayList, how do i bind those to the
    > > header
    > >
    > > 3/ After user fills out those textbox, I need to insert those infos to
    > > database, how can I do that?
    > >
    > > 4/ If users want to insert more than the rows printing, how can they add
    > > more rows?
    > >
    > > I appreciate any idea to get this problem solve.
    > >
    > > PS: If we can n't solve in datagrid, any solutions will be my big help
    > >
    > > Thanks everyone
    > >
    > >
    > >
    > >

    >
    >
    Hai Nguyen, Jan 15, 2004
    #5
  6. Hai Nguyen

    Alvin Bruney Guest

    just be sure to help someone else. that's what this place is about

    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "Hai Nguyen" <> wrote in message news:...
    Thank you Alvin, you are awesome


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:...
    this builds a grid like so
    % variance raw variance Wednesday 01/14/2004 Wednesday 01/07/2004


    then you build the rows to fill out the grid. Make sense?

    --
    Regards,
    Alvin Bruney
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "Hai Nguyen" <> wrote in message news:%...
    I'm sorry for asking you dump question. There are some part of your code I don't understand. Would you please feel free to explain it to me


    dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType( "System.Double" ) );
    dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType("System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("ddddMM/dd/yyyy"), System.Type.GetType"System.Double" ) );
    dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("ddddMM/dd/yyyy"), System.Type.GetType ("System.Double" ) );

    What does it mean?

    Thanks


    "Alvin Bruney" <vapor at steaming post office> wrote in message news:%23FW%23z%...
    > What you would need to do is build a datagrid manually one row at a time as
    > needed. When you construct a row, you will set the caption name and the
    > value items as you go along. This code creates 4 column datagrid. then adds
    > rows to it as needed
    >
    > DataSet dsTemp = new DataSet();
    >
    > DataTable Tables = new DataTable();
    >
    > dsTemp.Tables.Add(Tables);
    >
    > dsTemp.Tables[0].Columns.Add( " ", System.Type.GetType( "System.String" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "% variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( "raw variance", System.Type.GetType(
    > "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-1).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > dsTemp.Tables[0].Columns.Add( DateTime.Now.AddDays(-8).ToString("dddd
    > MM/dd/yyyy"), System.Type.GetType( "System.Double" ) );
    >
    > for(int col = 0; col < ds.Tables[0].Columns.Count; col++)
    >
    > {
    >
    > DataRow myRow = dsTemp.Tables[0].NewRow();
    >
    > myRow[4]= 0.00;
    >
    > if(Double.TryParse(ds2.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[4]= input.ToString();
    >
    >
    > myRow[3]= 0.00;
    >
    > if(Double.TryParse(ds.Tables[0].Rows[0][col].ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[3]= input.ToString();
    >
    >
    > if(Double.TryParse((Double.Parse(myRow[3].ToString()) -
    > Double.Parse(myRow[4].ToString())).ToString(),
    > System.Globalization.NumberStyles.Any,
    > System.Globalization.NumberFormatInfo.InvariantInfo, out input))
    >
    > myRow[2]= input.ToString();
    >
    > if(ds2.Tables[0].Rows[0][col].ToString().Trim() != String.Empty)
    >
    > myRow[1]= Math.Round(((Double.Parse(myRow[2].ToString()) /
    > Double.Parse(ds2.Tables[0].Rows[0][col].ToString())) * 100),2);
    >
    >
    > myRow[0]= ds.Tables[0].Columns[col].ColumnName;
    >
    > dsTemp.Tables[0].Rows.Add(myRow);
    >
    > }
    >
    > Feel free to modify the code as you see fit.
    >
    > --
    > Regards,
    > Alvin Bruney
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "Hai Nguyen" <> wrote in message
    > news:%...
    > > Hi all
    > >
    > > I'm trying to create form (can be anything, but a prefer it's a datagrid).
    > > It should look like this
    > >
    > > Header 1 Header 2 Header3 Header4 Header5
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > > (textbox) (textbox) (textbox) (textbox)
    > > (textbox)
    > >
    > >
    > > My question is:
    > > 1/ Since I don't know the number of row in advance, if I'm still be able

    > to
    > > generate datagrid with a particular number of row (let's say 10 rows)
    > >
    > > 2/ Because the header is stored in a ArrayList, how do i bind those to the
    > > header
    > >
    > > 3/ After user fills out those textbox, I need to insert those infos to
    > > database, how can I do that?
    > >
    > > 4/ If users want to insert more than the rows printing, how can they add
    > > more rows?
    > >
    > > I appreciate any idea to get this problem solve.
    > >
    > > PS: If we can n't solve in datagrid, any solutions will be my big help
    > >
    > > Thanks everyone
    > >
    > >
    > >
    > >

    >
    >
    Alvin Bruney, Jan 16, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher
    Replies:
    2
    Views:
    516
    Christopher
    Feb 16, 2004
  2. CodeMotion
    Replies:
    0
    Views:
    548
    CodeMotion
    Jul 3, 2003
  3. Hai Nguyen
    Replies:
    0
    Views:
    339
    Hai Nguyen
    Jan 15, 2004
  4. Arjen Hoekstra
    Replies:
    0
    Views:
    542
    Arjen Hoekstra
    Aug 2, 2005
  5. Martin
    Replies:
    2
    Views:
    697
    Hywel Jenkins
    Nov 11, 2005
Loading...

Share This Page