473,715 Members | 6,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Oct 16 '08 #1
6 3216
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" <mi**@beero.com wrote in message
news:Oi******** *****@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
Oct 17 '08 #2
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]" <No************ @planet.nlwrote in message
news:OY******** ******@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" <mi**@beero.com wrote in message
news:Oi******** *****@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
Oct 17 '08 #3
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" <mi**@beero.com wrote in message
news:Ox******** *****@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]" <No************ @planet.nlwrote in message
news:OY******** ******@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" <mi**@beero.com wrote in message
news:Oi******* ******@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
Oct 18 '08 #4
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]" <No************ @planet.nlwrote in message
news:uS******** ******@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" <mi**@beero.com wrote in message
news:Ox******** *****@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]" <No************ @planet.nlwrote in message
news:OY******* *******@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" <mi**@beero.com wrote in message
news:Oi****** *******@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

Oct 19 '08 #5
You can,

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

Cor

"Miro" <mi**@beero.com wrote in message
news:ue******** ******@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]" <No************ @planet.nlwrote in message
news:uS******** ******@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" <mi**@beero.com wrote in message
news:Ox******* ******@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]" <No************ @planet.nlwrote in message
news:OY****** ********@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" <mi**@beero.com wrote in message
news:Oi***** ********@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
>

Oct 19 '08 #6
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]" <No************ @planet.nlwrote in message
news:eY******** ******@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" <mi**@beero.com wrote in message
news:ue******** ******@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]" <No************ @planet.nlwrote in message
news:uS******* *******@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" <mi**@beero.com wrote in message
news:Ox****** *******@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]" <No************ @planet.nlwrote in message
news:OY***** *********@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" <mi**@beero.com wrote in message
news:Oi**** *********@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
>>
>

Oct 20 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3619
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes, and rebind the lstMyPersonnes to my DataGridView.dataSource, it shows the new record in the DataGridView as it should be. But when I click on a cell of that row, I suddenly got this error: "Index -1
6
6412
by: dbuchanan | last post by:
Hello, Is this a bug? Is there some kind of work around? I want to add default values for a few columns in my datagridview I found the "DefaultValuesNeeded" event for the datagridview I gave it a try using the example given in
10
39494
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got some DataGridViewTextBoxCell, DataGridViewComboBoxCell etc, i want to export all that to XML.. Any help is greatly appreciated.
3
32269
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable filtered by the dataview into a separate table? I only want to copy the rows from the main table that...
2
24554
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should you update after closing the grid/form, etc.? Also, can you tell me the best book to buy that fully explains the DataGridView control? Thanks.
7
12623
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
7
15655
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
0
2501
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by my.
3
5740
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows few celltemplate property getters and combobox/datecombo constructor calls without database access which does not take a lot of time. Debug output (below) shows lot of messages Stepping over non-user code. Running in release mode from...
0
5653
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be blank unless they are filled by the user. 2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If there's a value in the cell beforehand, that value is set as the value of the dtp editing control...
0
8823
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9343
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9198
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9104
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.