DataGridView new row

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miro

    DataGridView new row

    Sorry for the cross post. I am stuck.

    I have a datagridview for poker rounds.
    Basically there are 3 columns in this datagridview.
    "Round"
    "SmallBlind "
    "BigBlind"

    I have an issue when I tab through the new row being added. It does not
    'Add' that row, nor setup the 'next blank add row' so I can continue to tab
    through that row. ( I hope that makes sense ).

    Basically on the "DefaultValuesN eeded" I default ALL the columns for the
    user already, if there is already 1 row in the list.
    So:
    Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
    If e.Row.Index 0 Then
    Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
    e.Row.Cells("tx tBlindRound").V alue =
    CType(Me.dgvBli ndRounds.Item(" txtBlindRound", e.Row.Index - 1).Value,
    Integer) + 1
    e.Row.Cells("tx tSmallBlind").V alue =
    CType(Me.dgvBli ndRounds.Item(" txtSmallBlind", e.Row.Index - 1).Value,
    Integer) * 2
    e.Row.Cells("tx tBigBlind").Val ue =
    CType(Me.dgvBli ndRounds.Item(" txtBigBlind", e.Row.Index - 1).Value, Integer)
    * 2
    Endif
    EndSub

    So, this way, once the user enters the first row, and enters the next 'Blank
    row ready to be added' it defaults everything for them.
    *BUT*, unless the user actually types in one of the cells, the "Next Blank
    Row" never shows up. So if the current values that defaulted for the user
    are correct, they cannot just 'tab' through all the cells.
    How do I get the row to be 'added' if the user tabs through the whole new
    row (because all the defaults were correct) and also make it add the 'next
    blank row' so the tab key takes the user there and not to another control on
    the form.

    Thanks,

    Miro

  • Cor Ligthert[MVP]

    #2
    Re: DataGridView new row

    Miro,

    What do you think that the word Data mean in a DataGridView

    I see that you are using a Grid which is build like a (List)View, but where
    is your data?

    Cor

    "Miro" <miro@beero.com wrote in message
    news:OiWZxg7LJH A.468@TK2MSFTNG P06.phx.gbl...
    Sorry for the cross post. I am stuck.
    >
    I have a datagridview for poker rounds.
    Basically there are 3 columns in this datagridview.
    "Round"
    "SmallBlind "
    "BigBlind"
    >
    I have an issue when I tab through the new row being added. It does not
    'Add' that row, nor setup the 'next blank add row' so I can continue to
    tab through that row. ( I hope that makes sense ).
    >
    Basically on the "DefaultValuesN eeded" I default ALL the columns for the
    user already, if there is already 1 row in the list.
    So:
    Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
    If e.Row.Index 0 Then
    Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
    e.Row.Cells("tx tBlindRound").V alue =
    CType(Me.dgvBli ndRounds.Item(" txtBlindRound", e.Row.Index - 1).Value,
    Integer) + 1
    e.Row.Cells("tx tSmallBlind").V alue =
    CType(Me.dgvBli ndRounds.Item(" txtSmallBlind", e.Row.Index - 1).Value,
    Integer) * 2
    e.Row.Cells("tx tBigBlind").Val ue =
    CType(Me.dgvBli ndRounds.Item(" txtBigBlind", e.Row.Index - 1).Value,
    Integer) * 2
    Endif
    EndSub
    >
    So, this way, once the user enters the first row, and enters the next
    'Blank row ready to be added' it defaults everything for them.
    *BUT*, unless the user actually types in one of the cells, the "Next Blank
    Row" never shows up. So if the current values that defaulted for the user
    are correct, they cannot just 'tab' through all the cells.
    How do I get the row to be 'added' if the user tabs through the whole new
    row (because all the defaults were correct) and also make it add the 'next
    blank row' so the tab key takes the user there and not to another control
    on the form.
    >
    Thanks,
    >
    Miro
    >

    Comment

    • Miro

      #3
      Re: DataGridView new row

      I see that you are using a Grid which is build like a (List)View, but
      where is your data?
      My row is my data in my datagridview.
      My Fiile is actually :
      FileName: BlindRounds

      Fields:
      BlindRoundID (key unique id )
      Round (integer)
      SmallBlind (integer)
      BigBlind (integer)
      RoundTime (datetime)

      Instead of the user inputing 'Round, SmallBlind, BigBlind, RoundTime', 9
      times out of 10, the next round is usually double the last.
      So if the user inputs everything in the first data row, and tabs to the next
      'blank add row', then I know what I should "Default" all the data to.
      Round will be +1 the last,
      SmallBlind will be double the last smallblind
      BigBlind will be double the last BigBlind,
      and RoundTime will be equal to the last RoundTime.

      So im hoping the user should just have to 'tab' through all the fields
      available to him without making any changes and as soon as they get to the
      last column in the datagridview, it 'adds' that datarow, and starts a new
      'blank'' datarow for the whole process to start over again and this time
      were on 'round 3'.

      Once the user is happy with an X amount of rounds then they click the save
      button and everything saves back to the db.

      So for your question, that is my data, but since I can mathematically
      calculate 90% of the time what ALL the values of the new row should be. The
      user might not need to actually edit / change any column.

      Right now the user HAS TO change / edit a column for it to 'add' the 'next'
      blank row for the AllowUserToAddR ows property of the datagrid view.

      Im looking for the 'event' or something to call 'somewhere' that I guess
      "Simulates" an edit as soon as he tabs out of the last column, or I guess I
      can do it as soon as I default all the data.
      So since I can mathematically calculate all the columns of the next row - if
      the user 'tabs' through all the fields then I want to assume that they have
      'approved' the next rows data and continue on.
      Thus they are able to just 'hold' the tab key for about 5 seconds and they
      just entered a minute or two's worth of data.

      Thanks,

      Miro


      "Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
      news:OYGHh$AMJH A.3744@TK2MSFTN GP05.phx.gbl...
      Miro,
      >
      What do you think that the word Data mean in a DataGridView
      >
      I see that you are using a Grid which is build like a (List)View, but
      where is your data?
      >
      Cor
      >
      "Miro" <miro@beero.com wrote in message
      news:OiWZxg7LJH A.468@TK2MSFTNG P06.phx.gbl...
      >Sorry for the cross post. I am stuck.
      >>
      >I have a datagridview for poker rounds.
      >Basically there are 3 columns in this datagridview.
      >"Round"
      >"SmallBlind "
      >"BigBlind"
      >>
      >I have an issue when I tab through the new row being added. It does not
      >'Add' that row, nor setup the 'next blank add row' so I can continue to
      >tab through that row. ( I hope that makes sense ).
      >>
      >Basically on the "DefaultValuesN eeded" I default ALL the columns for the
      >user already, if there is already 1 row in the list.
      >So:
      >Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
      > If e.Row.Index 0 Then
      > Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
      > e.Row.Cells("tx tBlindRound").V alue =
      >CType(Me.dgvBl indRounds.Item( "txtBlindRound" , e.Row.Index - 1).Value,
      >Integer) + 1
      > e.Row.Cells("tx tSmallBlind").V alue =
      >CType(Me.dgvBl indRounds.Item( "txtSmallBlind" , e.Row.Index - 1).Value,
      >Integer) * 2
      > e.Row.Cells("tx tBigBlind").Val ue =
      >CType(Me.dgvBl indRounds.Item( "txtBigBlin d", e.Row.Index - 1).Value,
      >Integer) * 2
      > Endif
      >EndSub
      >>
      >So, this way, once the user enters the first row, and enters the next
      >'Blank row ready to be added' it defaults everything for them.
      >*BUT*, unless the user actually types in one of the cells, the "Next
      >Blank Row" never shows up. So if the current values that defaulted for
      >the user are correct, they cannot just 'tab' through all the cells.
      >How do I get the row to be 'added' if the user tabs through the whole new
      >row (because all the defaults were correct) and also make it add the
      >'next blank row' so the tab key takes the user there and not to another
      >control on the form.
      >>
      >Thanks,
      >>
      >Miro
      >>
      >

      Comment

      • Cor Ligthert[MVP]

        #4
        Re: DataGridView new row

        Miro,

        Simple make a datatable, set that to a bindingsource.d atasource and set that
        again to your DataGridView, everything becomes than more easy to handle

        \\\
        Dim dt as new DataTable
        dim dc1 as new Column
        dim dc2 as new column
        dt.columns.add( dc1)
        dt.columns.add( dc2)
        'make and add as much columns as you need
        for i = 0 to 2
        dim dr as dt.newrow
        dt.rows.add(dr)
        next
        dim bs as new BindingSource
        bs.Datasource = dt
        MyDataGridView. DataSource = bs
        ///

        This is created in this message so watch typos or whatever,

        Cor


        "Miro" <miro@beero.com wrote in message
        news:OxTy8SDMJH A.468@TK2MSFTNG P06.phx.gbl...
        >I see that you are using a Grid which is build like a (List)View, but
        >where is your data?
        >
        My row is my data in my datagridview.
        My Fiile is actually :
        FileName: BlindRounds
        >
        Fields:
        BlindRoundID (key unique id )
        Round (integer)
        SmallBlind (integer)
        BigBlind (integer)
        RoundTime (datetime)
        >
        Instead of the user inputing 'Round, SmallBlind, BigBlind, RoundTime', 9
        times out of 10, the next round is usually double the last.
        So if the user inputs everything in the first data row, and tabs to the
        next 'blank add row', then I know what I should "Default" all the data to.
        Round will be +1 the last,
        SmallBlind will be double the last smallblind
        BigBlind will be double the last BigBlind,
        and RoundTime will be equal to the last RoundTime.
        >
        So im hoping the user should just have to 'tab' through all the fields
        available to him without making any changes and as soon as they get to the
        last column in the datagridview, it 'adds' that datarow, and starts a new
        'blank'' datarow for the whole process to start over again and this time
        were on 'round 3'.
        >
        Once the user is happy with an X amount of rounds then they click the save
        button and everything saves back to the db.
        >
        So for your question, that is my data, but since I can mathematically
        calculate 90% of the time what ALL the values of the new row should be.
        The user might not need to actually edit / change any column.
        >
        Right now the user HAS TO change / edit a column for it to 'add' the
        'next' blank row for the AllowUserToAddR ows property of the datagrid view.
        >
        Im looking for the 'event' or something to call 'somewhere' that I guess
        "Simulates" an edit as soon as he tabs out of the last column, or I guess
        I can do it as soon as I default all the data.
        So since I can mathematically calculate all the columns of the next row -
        if the user 'tabs' through all the fields then I want to assume that they
        have 'approved' the next rows data and continue on.
        Thus they are able to just 'hold' the tab key for about 5 seconds and they
        just entered a minute or two's worth of data.
        >
        Thanks,
        >
        Miro
        >
        >
        "Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
        news:OYGHh$AMJH A.3744@TK2MSFTN GP05.phx.gbl...
        >Miro,
        >>
        >What do you think that the word Data mean in a DataGridView
        >>
        >I see that you are using a Grid which is build like a (List)View, but
        >where is your data?
        >>
        >Cor
        >>
        >"Miro" <miro@beero.com wrote in message
        >news:OiWZxg7LJ HA.468@TK2MSFTN GP06.phx.gbl...
        >>Sorry for the cross post. I am stuck.
        >>>
        >>I have a datagridview for poker rounds.
        >>Basically there are 3 columns in this datagridview.
        >>"Round"
        >>"SmallBlind "
        >>"BigBlind"
        >>>
        >>I have an issue when I tab through the new row being added. It does not
        >>'Add' that row, nor setup the 'next blank add row' so I can continue to
        >>tab through that row. ( I hope that makes sense ).
        >>>
        >>Basically on the "DefaultValuesN eeded" I default ALL the columns for the
        >>user already, if there is already 1 row in the list.
        >>So:
        >>Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
        >> If e.Row.Index 0 Then
        >> Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
        >> e.Row.Cells("tx tBlindRound").V alue =
        >>CType(Me.dgvB lindRounds.Item ("txtBlindRound ", e.Row.Index - 1).Value,
        >>Integer) + 1
        >> e.Row.Cells("tx tSmallBlind").V alue =
        >>CType(Me.dgvB lindRounds.Item ("txtSmallBlind ", e.Row.Index - 1).Value,
        >>Integer) * 2
        >> e.Row.Cells("tx tBigBlind").Val ue =
        >>CType(Me.dgvB lindRounds.Item ("txtBigBlin d", e.Row.Index - 1).Value,
        >>Integer) * 2
        >> Endif
        >>EndSub
        >>>
        >>So, this way, once the user enters the first row, and enters the next
        >>'Blank row ready to be added' it defaults everything for them.
        >>*BUT*, unless the user actually types in one of the cells, the "Next
        >>Blank Row" never shows up. So if the current values that defaulted for
        >>the user are correct, they cannot just 'tab' through all the cells.
        >>How do I get the row to be 'added' if the user tabs through the whole
        >>new row (because all the defaults were correct) and also make it add the
        >>'next blank row' so the tab key takes the user there and not to another
        >>control on the form.
        >>>
        >>Thanks,
        >>>
        >>Miro
        >>>
        >>
        >

        Comment

        • Miro

          #5
          Re: DataGridView new row

          Hi Cor,

          My issue is, is that I do not know how many times / rounds the user wants,
          and sometimes the blinds are not always double for whatever reason.

          I know I could add the rows manually to it, but i was hoping for a solution
          where I can just "Tab" thru and it would keep adding it.
          But it looks like the 'new' temp row the datagridview addes is in somekind
          of a 'dirtystate' or something and until a value is changed in that row - it
          assumes its not going to be added and doesnt add another one.

          I was looking for something that I can override in that 'new row' and as
          soon as the cursor hits that new row I can add it already to the list of
          datarows. Simply put, the last one I would make them delete out.

          I was just trying to accomplish somethign ( holding tab and proper data gets
          added ) that I did some work in another language in another system. The
          users loved it. So I was just playing here and trying to re-create it.

          Thanks for the help.

          Miro

          "Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
          news:uSFojqNMJH A.4600@TK2MSFTN GP06.phx.gbl...
          Miro,
          >
          Simple make a datatable, set that to a bindingsource.d atasource and set
          that again to your DataGridView, everything becomes than more easy to
          handle
          >
          \\\
          Dim dt as new DataTable
          dim dc1 as new Column
          dim dc2 as new column
          dt.columns.add( dc1)
          dt.columns.add( dc2)
          'make and add as much columns as you need
          for i = 0 to 2
          dim dr as dt.newrow
          dt.rows.add(dr)
          next
          dim bs as new BindingSource
          bs.Datasource = dt
          MyDataGridView. DataSource = bs
          ///
          >
          This is created in this message so watch typos or whatever,
          >
          Cor
          >
          >
          "Miro" <miro@beero.com wrote in message
          news:OxTy8SDMJH A.468@TK2MSFTNG P06.phx.gbl...
          >>I see that you are using a Grid which is build like a (List)View, but
          >>where is your data?
          >>
          >My row is my data in my datagridview.
          >My Fiile is actually :
          >FileName: BlindRounds
          >>
          >Fields:
          >BlindRoundID (key unique id )
          >Round (integer)
          >SmallBlind (integer)
          >BigBlind (integer)
          >RoundTime (datetime)
          >>
          >Instead of the user inputing 'Round, SmallBlind, BigBlind, RoundTime', 9
          >times out of 10, the next round is usually double the last.
          >So if the user inputs everything in the first data row, and tabs to the
          >next 'blank add row', then I know what I should "Default" all the data
          >to.
          >Round will be +1 the last,
          >SmallBlind will be double the last smallblind
          >BigBlind will be double the last BigBlind,
          >and RoundTime will be equal to the last RoundTime.
          >>
          >So im hoping the user should just have to 'tab' through all the fields
          >available to him without making any changes and as soon as they get to
          >the last column in the datagridview, it 'adds' that datarow, and starts a
          >new 'blank'' datarow for the whole process to start over again and this
          >time were on 'round 3'.
          >>
          >Once the user is happy with an X amount of rounds then they click the
          >save button and everything saves back to the db.
          >>
          >So for your question, that is my data, but since I can mathematically
          >calculate 90% of the time what ALL the values of the new row should be.
          >The user might not need to actually edit / change any column.
          >>
          >Right now the user HAS TO change / edit a column for it to 'add' the
          >'next' blank row for the AllowUserToAddR ows property of the datagrid
          >view.
          >>
          >Im looking for the 'event' or something to call 'somewhere' that I guess
          >"Simulates" an edit as soon as he tabs out of the last column, or I guess
          >I can do it as soon as I default all the data.
          >So since I can mathematically calculate all the columns of the next row -
          >if the user 'tabs' through all the fields then I want to assume that they
          >have 'approved' the next rows data and continue on.
          >Thus they are able to just 'hold' the tab key for about 5 seconds and
          >they just entered a minute or two's worth of data.
          >>
          >Thanks,
          >>
          >Miro
          >>
          >>
          >"Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
          >news:OYGHh$AMJ HA.3744@TK2MSFT NGP05.phx.gbl.. .
          >>Miro,
          >>>
          >>What do you think that the word Data mean in a DataGridView
          >>>
          >>I see that you are using a Grid which is build like a (List)View, but
          >>where is your data?
          >>>
          >>Cor
          >>>
          >>"Miro" <miro@beero.com wrote in message
          >>news:OiWZxg7L JHA.468@TK2MSFT NGP06.phx.gbl.. .
          >>>Sorry for the cross post. I am stuck.
          >>>>
          >>>I have a datagridview for poker rounds.
          >>>Basically there are 3 columns in this datagridview.
          >>>"Round"
          >>>"SmallBlin d"
          >>>"BigBlind"
          >>>>
          >>>I have an issue when I tab through the new row being added. It does
          >>>not 'Add' that row, nor setup the 'next blank add row' so I can
          >>>continue to tab through that row. ( I hope that makes sense ).
          >>>>
          >>>Basically on the "DefaultValuesN eeded" I default ALL the columns for
          >>>the user already, if there is already 1 row in the list.
          >>>So:
          >>>Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
          >>> If e.Row.Index 0 Then
          >>> Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
          >>> e.Row.Cells("tx tBlindRound").V alue =
          >>>CType(Me.dgv BlindRounds.Ite m("txtBlindRoun d", e.Row.Index - 1).Value,
          >>>Integer) + 1
          >>> e.Row.Cells("tx tSmallBlind").V alue =
          >>>CType(Me.dgv BlindRounds.Ite m("txtSmallBlin d", e.Row.Index - 1).Value,
          >>>Integer) * 2
          >>> e.Row.Cells("tx tBigBlind").Val ue =
          >>>CType(Me.dgv BlindRounds.Ite m("txtBigBlind" , e.Row.Index - 1).Value,
          >>>Integer) * 2
          >>> Endif
          >>>EndSub
          >>>>
          >>>So, this way, once the user enters the first row, and enters the next
          >>>'Blank row ready to be added' it defaults everything for them.
          >>>*BUT*, unless the user actually types in one of the cells, the "Next
          >>>Blank Row" never shows up. So if the current values that defaulted for
          >>>the user are correct, they cannot just 'tab' through all the cells.
          >>>How do I get the row to be 'added' if the user tabs through the whole
          >>>new row (because all the defaults were correct) and also make it add
          >>>the 'next blank row' so the tab key takes the user there and not to
          >>>another control on the form.
          >>>>
          >>>Thanks,
          >>>>
          >>>Miro
          >>>>
          >>>
          >>
          >

          Comment

          • Cor Ligthert[MVP]

            #6
            Re: DataGridView new row

            You can,

            Simply add in the add button at the bottom on the datagridview and it will
            be created in your datasource.

            Cor

            "Miro" <miro@beero.com wrote in message
            news:ueXV9nYMJH A.6044@TK2MSFTN GP02.phx.gbl...
            Hi Cor,
            >
            My issue is, is that I do not know how many times / rounds the user wants,
            and sometimes the blinds are not always double for whatever reason.
            >
            I know I could add the rows manually to it, but i was hoping for a
            solution where I can just "Tab" thru and it would keep adding it.
            But it looks like the 'new' temp row the datagridview addes is in somekind
            of a 'dirtystate' or something and until a value is changed in that row -
            it assumes its not going to be added and doesnt add another one.
            >
            I was looking for something that I can override in that 'new row' and as
            soon as the cursor hits that new row I can add it already to the list of
            datarows. Simply put, the last one I would make them delete out.
            >
            I was just trying to accomplish somethign ( holding tab and proper data
            gets added ) that I did some work in another language in another system.
            The users loved it. So I was just playing here and trying to re-create
            it.
            >
            Thanks for the help.
            >
            Miro
            >
            "Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
            news:uSFojqNMJH A.4600@TK2MSFTN GP06.phx.gbl...
            >Miro,
            >>
            >Simple make a datatable, set that to a bindingsource.d atasource and set
            >that again to your DataGridView, everything becomes than more easy to
            >handle
            >>
            >\\\
            >Dim dt as new DataTable
            >dim dc1 as new Column
            >dim dc2 as new column
            >dt.columns.add (dc1)
            >dt.columns.add (dc2)
            >'make and add as much columns as you need
            >for i = 0 to 2
            > dim dr as dt.newrow
            > dt.rows.add(dr)
            >next
            >dim bs as new BindingSource
            >bs.Datasourc e = dt
            >MyDataGridView .DataSource = bs
            >///
            >>
            >This is created in this message so watch typos or whatever,
            >>
            >Cor
            >>
            >>
            >"Miro" <miro@beero.com wrote in message
            >news:OxTy8SDMJ HA.468@TK2MSFTN GP06.phx.gbl...
            >>>I see that you are using a Grid which is build like a (List)View, but
            >>>where is your data?
            >>>
            >>My row is my data in my datagridview.
            >>My Fiile is actually :
            >>FileName: BlindRounds
            >>>
            >>Fields:
            >>BlindRoundI D (key unique id )
            >>Round (integer)
            >>SmallBlind (integer)
            >>BigBlind (integer)
            >>RoundTime (datetime)
            >>>
            >>Instead of the user inputing 'Round, SmallBlind, BigBlind, RoundTime',
            >>9 times out of 10, the next round is usually double the last.
            >>So if the user inputs everything in the first data row, and tabs to the
            >>next 'blank add row', then I know what I should "Default" all the data
            >>to.
            >>Round will be +1 the last,
            >>SmallBlind will be double the last smallblind
            >>BigBlind will be double the last BigBlind,
            >>and RoundTime will be equal to the last RoundTime.
            >>>
            >>So im hoping the user should just have to 'tab' through all the fields
            >>available to him without making any changes and as soon as they get to
            >>the last column in the datagridview, it 'adds' that datarow, and starts
            >>a new 'blank'' datarow for the whole process to start over again and
            >>this time were on 'round 3'.
            >>>
            >>Once the user is happy with an X amount of rounds then they click the
            >>save button and everything saves back to the db.
            >>>
            >>So for your question, that is my data, but since I can mathematically
            >>calculate 90% of the time what ALL the values of the new row should be.
            >>The user might not need to actually edit / change any column.
            >>>
            >>Right now the user HAS TO change / edit a column for it to 'add' the
            >>'next' blank row for the AllowUserToAddR ows property of the datagrid
            >>view.
            >>>
            >>Im looking for the 'event' or something to call 'somewhere' that I guess
            >>"Simulates" an edit as soon as he tabs out of the last column, or I
            >>guess I can do it as soon as I default all the data.
            >>So since I can mathematically calculate all the columns of the next
            >>row - if the user 'tabs' through all the fields then I want to assume
            >>that they have 'approved' the next rows data and continue on.
            >>Thus they are able to just 'hold' the tab key for about 5 seconds and
            >>they just entered a minute or two's worth of data.
            >>>
            >>Thanks,
            >>>
            >>Miro
            >>>
            >>>
            >>"Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
            >>news:OYGHh$AM JHA.3744@TK2MSF TNGP05.phx.gbl. ..
            >>>Miro,
            >>>>
            >>>What do you think that the word Data mean in a DataGridView
            >>>>
            >>>I see that you are using a Grid which is build like a (List)View, but
            >>>where is your data?
            >>>>
            >>>Cor
            >>>>
            >>>"Miro" <miro@beero.com wrote in message
            >>>news:OiWZxg7 LJHA.468@TK2MSF TNGP06.phx.gbl. ..
            >>>>Sorry for the cross post. I am stuck.
            >>>>>
            >>>>I have a datagridview for poker rounds.
            >>>>Basically there are 3 columns in this datagridview.
            >>>>"Round"
            >>>>"SmallBlind "
            >>>>"BigBlind "
            >>>>>
            >>>>I have an issue when I tab through the new row being added. It does
            >>>>not 'Add' that row, nor setup the 'next blank add row' so I can
            >>>>continue to tab through that row. ( I hope that makes sense ).
            >>>>>
            >>>>Basically on the "DefaultValuesN eeded" I default ALL the columns for
            >>>>the user already, if there is already 1 row in the list.
            >>>>So:
            >>>>Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
            >>>> If e.Row.Index 0 Then
            >>>> Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
            >>>> e.Row.Cells("tx tBlindRound").V alue =
            >>>>CType(Me.dg vBlindRounds.It em("txtBlindRou nd", e.Row.Index - 1).Value,
            >>>>Integer) + 1
            >>>> e.Row.Cells("tx tSmallBlind").V alue =
            >>>>CType(Me.dg vBlindRounds.It em("txtSmallBli nd", e.Row.Index - 1).Value,
            >>>>Integer) * 2
            >>>> e.Row.Cells("tx tBigBlind").Val ue =
            >>>>CType(Me.dg vBlindRounds.It em("txtBigBlind ", e.Row.Index - 1).Value,
            >>>>Integer) * 2
            >>>> Endif
            >>>>EndSub
            >>>>>
            >>>>So, this way, once the user enters the first row, and enters the next
            >>>>'Blank row ready to be added' it defaults everything for them.
            >>>>*BUT*, unless the user actually types in one of the cells, the "Next
            >>>>Blank Row" never shows up. So if the current values that defaulted
            >>>>for the user are correct, they cannot just 'tab' through all the
            >>>>cells.
            >>>>How do I get the row to be 'added' if the user tabs through the whole
            >>>>new row (because all the defaults were correct) and also make it add
            >>>>the 'next blank row' so the tab key takes the user there and not to
            >>>>another control on the form.
            >>>>>
            >>>>Thanks,
            >>>>>
            >>>>Miro
            >>>>>
            >>>>
            >>>
            >>
            >

            Comment

            • Miro

              #7
              Re: DataGridView new row

              I got rid of the add button :)
              and all the buttons,

              so its strictly a tabbing window.
              But maybe that is my probelm, I am trying a layout that should not be /Is
              not a .net layout.
              It was the same idea I used from some greenscreen programming I did.

              But what I am starting to see, is that in most cases, the
              'AllowUserToAdd Rows' option on a datagridview, is used for somethign else,
              and not what I am intending to use it for.

              Miro


              "Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
              news:eYOYynbMJH A.2760@TK2MSFTN GP06.phx.gbl...
              You can,
              >
              Simply add in the add button at the bottom on the datagridview and it will
              be created in your datasource.
              >
              Cor
              >
              "Miro" <miro@beero.com wrote in message
              news:ueXV9nYMJH A.6044@TK2MSFTN GP02.phx.gbl...
              >Hi Cor,
              >>
              >My issue is, is that I do not know how many times / rounds the user
              >wants, and sometimes the blinds are not always double for whatever
              >reason.
              >>
              >I know I could add the rows manually to it, but i was hoping for a
              >solution where I can just "Tab" thru and it would keep adding it.
              >But it looks like the 'new' temp row the datagridview addes is in
              >somekind of a 'dirtystate' or something and until a value is changed in
              >that row - it assumes its not going to be added and doesnt add another
              >one.
              >>
              >I was looking for something that I can override in that 'new row' and as
              >soon as the cursor hits that new row I can add it already to the list of
              >datarows. Simply put, the last one I would make them delete out.
              >>
              >I was just trying to accomplish somethign ( holding tab and proper data
              >gets added ) that I did some work in another language in another system.
              >The users loved it. So I was just playing here and trying to re-create
              >it.
              >>
              >Thanks for the help.
              >>
              >Miro
              >>
              >"Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
              >news:uSFojqNMJ HA.4600@TK2MSFT NGP06.phx.gbl.. .
              >>Miro,
              >>>
              >>Simple make a datatable, set that to a bindingsource.d atasource and set
              >>that again to your DataGridView, everything becomes than more easy to
              >>handle
              >>>
              >>\\\
              >>Dim dt as new DataTable
              >>dim dc1 as new Column
              >>dim dc2 as new column
              >>dt.columns.ad d(dc1)
              >>dt.columns.ad d(dc2)
              >>'make and add as much columns as you need
              >>for i = 0 to 2
              >> dim dr as dt.newrow
              >> dt.rows.add(dr)
              >>next
              >>dim bs as new BindingSource
              >>bs.Datasour ce = dt
              >>MyDataGridVie w.DataSource = bs
              >>///
              >>>
              >>This is created in this message so watch typos or whatever,
              >>>
              >>Cor
              >>>
              >>>
              >>"Miro" <miro@beero.com wrote in message
              >>news:OxTy8SDM JHA.468@TK2MSFT NGP06.phx.gbl.. .
              >>>>I see that you are using a Grid which is build like a (List)View, but
              >>>>where is your data?
              >>>>
              >>>My row is my data in my datagridview.
              >>>My Fiile is actually :
              >>>FileName: BlindRounds
              >>>>
              >>>Fields:
              >>>BlindRound ID (key unique id )
              >>>Round (integer)
              >>>SmallBlind (integer)
              >>>BigBlind (integer)
              >>>RoundTime (datetime)
              >>>>
              >>>Instead of the user inputing 'Round, SmallBlind, BigBlind, RoundTime',
              >>>9 times out of 10, the next round is usually double the last.
              >>>So if the user inputs everything in the first data row, and tabs to the
              >>>next 'blank add row', then I know what I should "Default" all the data
              >>>to.
              >>>Round will be +1 the last,
              >>>SmallBlind will be double the last smallblind
              >>>BigBlind will be double the last BigBlind,
              >>>and RoundTime will be equal to the last RoundTime.
              >>>>
              >>>So im hoping the user should just have to 'tab' through all the fields
              >>>available to him without making any changes and as soon as they get to
              >>>the last column in the datagridview, it 'adds' that datarow, and starts
              >>>a new 'blank'' datarow for the whole process to start over again and
              >>>this time were on 'round 3'.
              >>>>
              >>>Once the user is happy with an X amount of rounds then they click the
              >>>save button and everything saves back to the db.
              >>>>
              >>>So for your question, that is my data, but since I can mathematically
              >>>calculate 90% of the time what ALL the values of the new row should be.
              >>>The user might not need to actually edit / change any column.
              >>>>
              >>>Right now the user HAS TO change / edit a column for it to 'add' the
              >>>'next' blank row for the AllowUserToAddR ows property of the datagrid
              >>>view.
              >>>>
              >>>Im looking for the 'event' or something to call 'somewhere' that I
              >>>guess "Simulates" an edit as soon as he tabs out of the last column, or
              >>>I guess I can do it as soon as I default all the data.
              >>>So since I can mathematically calculate all the columns of the next
              >>>row - if the user 'tabs' through all the fields then I want to assume
              >>>that they have 'approved' the next rows data and continue on.
              >>>Thus they are able to just 'hold' the tab key for about 5 seconds and
              >>>they just entered a minute or two's worth of data.
              >>>>
              >>>Thanks,
              >>>>
              >>>Miro
              >>>>
              >>>>
              >>>"Cor Ligthert[MVP]" <Notmyfirstname @planet.nlwrote in message
              >>>news:OYGHh$A MJHA.3744@TK2MS FTNGP05.phx.gbl ...
              >>>>Miro,
              >>>>>
              >>>>What do you think that the word Data mean in a DataGridView
              >>>>>
              >>>>I see that you are using a Grid which is build like a (List)View, but
              >>>>where is your data?
              >>>>>
              >>>>Cor
              >>>>>
              >>>>"Miro" <miro@beero.com wrote in message
              >>>>news:OiWZxg 7LJHA.468@TK2MS FTNGP06.phx.gbl ...
              >>>>>Sorry for the cross post. I am stuck.
              >>>>>>
              >>>>>I have a datagridview for poker rounds.
              >>>>>Basicall y there are 3 columns in this datagridview.
              >>>>>"Round"
              >>>>>"SmallBlin d"
              >>>>>"BigBlin d"
              >>>>>>
              >>>>>I have an issue when I tab through the new row being added. It does
              >>>>>not 'Add' that row, nor setup the 'next blank add row' so I can
              >>>>>continue to tab through that row. ( I hope that makes sense ).
              >>>>>>
              >>>>>Basicall y on the "DefaultValuesN eeded" I default ALL the columns for
              >>>>>the user already, if there is already 1 row in the list.
              >>>>>So:
              >>>>>Private Sub dgvBlindRounds_ DefaultValuesNe eded( ...
              >>>>> If e.Row.Index 0 Then
              >>>>> Dim tempRow As DataGridViewRow = Me.dgvBlindRoun ds.Rows(0)
              >>>>> e.Row.Cells("tx tBlindRound").V alue =
              >>>>>CType(Me.d gvBlindRounds.I tem("txtBlindRo und", e.Row.Index - 1).Value,
              >>>>>Integer) + 1
              >>>>> e.Row.Cells("tx tSmallBlind").V alue =
              >>>>>CType(Me.d gvBlindRounds.I tem("txtSmallBl ind", e.Row.Index - 1).Value,
              >>>>>Integer) * 2
              >>>>> e.Row.Cells("tx tBigBlind").Val ue =
              >>>>>CType(Me.d gvBlindRounds.I tem("txtBigBlin d", e.Row.Index - 1).Value,
              >>>>>Integer) * 2
              >>>>> Endif
              >>>>>EndSub
              >>>>>>
              >>>>>So, this way, once the user enters the first row, and enters the next
              >>>>>'Blank row ready to be added' it defaults everything for them.
              >>>>>*BUT*, unless the user actually types in one of the cells, the "Next
              >>>>>Blank Row" never shows up. So if the current values that defaulted
              >>>>>for the user are correct, they cannot just 'tab' through all the
              >>>>>cells.
              >>>>>How do I get the row to be 'added' if the user tabs through the whole
              >>>>>new row (because all the defaults were correct) and also make it add
              >>>>>the 'next blank row' so the tab key takes the user there and not to
              >>>>>another control on the form.
              >>>>>>
              >>>>>Thanks,
              >>>>>>
              >>>>>Miro
              >>>>>>
              >>>>>
              >>>>
              >>>
              >>
              >

              Comment

              Working...