![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 "DefaultValuesNeeded" I default ALL the columns for the user already, if there is already 1 row in the list. So: Private Sub dgvBlindRounds_DefaultValuesNeeded( ... If e.Row.Index > 0 Then Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) e.Row.Cells("txtBlindRound").Value = CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, Integer) + 1 e.Row.Cells("txtSmallBlind").Value = CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, Integer) * 2 e.Row.Cells("txtBigBlind").Value = CType(Me.dgvBlindRounds.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 |
My System Specs![]() |
| | #2 (permalink) |
| | 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@xxxxxx> wrote in message news:OiWZxg7LJHA.468@xxxxxx Quote: > 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 "DefaultValuesNeeded" I default ALL the columns for the > user already, if there is already 1 row in the list. > So: > Private Sub dgvBlindRounds_DefaultValuesNeeded( ... > If e.Row.Index > 0 Then > Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) > e.Row.Cells("txtBlindRound").Value = > CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, > Integer) + 1 > e.Row.Cells("txtSmallBlind").Value = > CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, > Integer) * 2 > e.Row.Cells("txtBigBlind").Value = > CType(Me.dgvBlindRounds.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 > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: DataGridView new row > I see that you are using a Grid which is build like a (List)View, but Quote: > where is your data? 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 AllowUserToAddRows 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@xxxxxx> wrote in message news:OYGHh$AMJHA.3744@xxxxxx Quote: > 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@xxxxxx> wrote in message > news:OiWZxg7LJHA.468@xxxxxx Quote: >> 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 "DefaultValuesNeeded" I default ALL the columns for the >> user already, if there is already 1 row in the list. >> So: >> Private Sub dgvBlindRounds_DefaultValuesNeeded( ... >> If e.Row.Index > 0 Then >> Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) >> e.Row.Cells("txtBlindRound").Value = >> CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, >> Integer) + 1 >> e.Row.Cells("txtSmallBlind").Value = >> CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, >> Integer) * 2 >> e.Row.Cells("txtBigBlind").Value = >> CType(Me.dgvBlindRounds.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 >> |
My System Specs![]() |
| | #4 (permalink) |
| | Re: DataGridView new row Miro, Simple make a datatable, set that to a bindingsource.datasource 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@xxxxxx> wrote in message news:OxTy8SDMJHA.468@xxxxxx Quote: Quote: >> 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 AllowUserToAddRows 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@xxxxxx> wrote in message > news:OYGHh$AMJHA.3744@xxxxxx Quote: >> 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@xxxxxx> wrote in message >> news:OiWZxg7LJHA.468@xxxxxx Quote: >>> 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 "DefaultValuesNeeded" I default ALL the columns for the >>> user already, if there is already 1 row in the list. >>> So: >>> Private Sub dgvBlindRounds_DefaultValuesNeeded( ... >>> If e.Row.Index > 0 Then >>> Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) >>> e.Row.Cells("txtBlindRound").Value = >>> CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, >>> Integer) + 1 >>> e.Row.Cells("txtSmallBlind").Value = >>> CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, >>> Integer) * 2 >>> e.Row.Cells("txtBigBlind").Value = >>> CType(Me.dgvBlindRounds.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 >>> |
My System Specs![]() |
| | #5 (permalink) |
| | 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@xxxxxx> wrote in message news:uSFojqNMJHA.4600@xxxxxx Quote: > Miro, > > Simple make a datatable, set that to a bindingsource.datasource 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@xxxxxx> wrote in message > news:OxTy8SDMJHA.468@xxxxxx Quote: Quote: >>> 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 AllowUserToAddRows 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@xxxxxx> wrote in message >> news:OYGHh$AMJHA.3744@xxxxxx Quote: >>> 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@xxxxxx> wrote in message >>> news:OiWZxg7LJHA.468@xxxxxx >>>> 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 "DefaultValuesNeeded" I default ALL the columns for >>>> the user already, if there is already 1 row in the list. >>>> So: >>>> Private Sub dgvBlindRounds_DefaultValuesNeeded( ... >>>> If e.Row.Index > 0 Then >>>> Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) >>>> e.Row.Cells("txtBlindRound").Value = >>>> CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, >>>> Integer) + 1 >>>> e.Row.Cells("txtSmallBlind").Value = >>>> CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, >>>> Integer) * 2 >>>> e.Row.Cells("txtBigBlind").Value = >>>> CType(Me.dgvBlindRounds.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 >>>> >>> |
My System Specs![]() |
| | #6 (permalink) |
| | 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@xxxxxx> wrote in message news:ueXV9nYMJHA.6044@xxxxxx Quote: > 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@xxxxxx> wrote in message > news:uSFojqNMJHA.4600@xxxxxx Quote: >> Miro, >> >> Simple make a datatable, set that to a bindingsource.datasource 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@xxxxxx> wrote in message >> news:OxTy8SDMJHA.468@xxxxxx Quote: >>>> 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 AllowUserToAddRows 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@xxxxxx> wrote in message >>> news:OYGHh$AMJHA.3744@xxxxxx >>>> 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@xxxxxx> wrote in message >>>> news:OiWZxg7LJHA.468@xxxxxx >>>>> 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 "DefaultValuesNeeded" I default ALL the columns for >>>>> the user already, if there is already 1 row in the list. >>>>> So: >>>>> Private Sub dgvBlindRounds_DefaultValuesNeeded( ... >>>>> If e.Row.Index > 0 Then >>>>> Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) >>>>> e.Row.Cells("txtBlindRound").Value = >>>>> CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, >>>>> Integer) + 1 >>>>> e.Row.Cells("txtSmallBlind").Value = >>>>> CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, >>>>> Integer) * 2 >>>>> e.Row.Cells("txtBigBlind").Value = >>>>> CType(Me.dgvBlindRounds.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 >>>>> >>>> >>> |
My System Specs![]() |
| | #7 (permalink) |
| | 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 'AllowUserToAddRows' option on a datagridview, is used for somethign else, and not what I am intending to use it for. Miro "Cor Ligthert[MVP]" <Notmyfirstname@xxxxxx> wrote in message news:eYOYynbMJHA.2760@xxxxxx Quote: > 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@xxxxxx> wrote in message > news:ueXV9nYMJHA.6044@xxxxxx Quote: >> 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@xxxxxx> wrote in message >> news:uSFojqNMJHA.4600@xxxxxx Quote: >>> Miro, >>> >>> Simple make a datatable, set that to a bindingsource.datasource 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@xxxxxx> wrote in message >>> news:OxTy8SDMJHA.468@xxxxxx >>>>> 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 AllowUserToAddRows 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@xxxxxx> wrote in message >>>> news:OYGHh$AMJHA.3744@xxxxxx >>>>> 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@xxxxxx> wrote in message >>>>> news:OiWZxg7LJHA.468@xxxxxx >>>>>> 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 "DefaultValuesNeeded" I default ALL the columns for >>>>>> the user already, if there is already 1 row in the list. >>>>>> So: >>>>>> Private Sub dgvBlindRounds_DefaultValuesNeeded( ... >>>>>> If e.Row.Index > 0 Then >>>>>> Dim tempRow As DataGridViewRow = Me.dgvBlindRounds.Rows(0) >>>>>> e.Row.Cells("txtBlindRound").Value = >>>>>> CType(Me.dgvBlindRounds.Item("txtBlindRound", e.Row.Index - 1).Value, >>>>>> Integer) + 1 >>>>>> e.Row.Cells("txtSmallBlind").Value = >>>>>> CType(Me.dgvBlindRounds.Item("txtSmallBlind", e.Row.Index - 1).Value, >>>>>> Integer) * 2 >>>>>> e.Row.Cells("txtBigBlind").Value = >>>>>> CType(Me.dgvBlindRounds.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 >>>>>> >>>>> >>>> >>> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| scrolling datagridview | .NET General | |||
| Image in DataGridView from SQL | .NET General | |||
| Re: datagridview | .NET General | |||
| Refeshing a DataGridView | .NET General | |||
| Get the position in a DataGridView | .NET General | |||