473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Oct 16 '08 #1
6 2813
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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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
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 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]" <No************@planet.nlwrote in message
news:OY**************@TK2MSFTNGP05.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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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
Oct 17 '08 #3
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" <mi**@beero.comwrote in message
news:Ox*************@TK2MSFTNGP06.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 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]" <No************@planet.nlwrote in message
news:OY**************@TK2MSFTNGP05.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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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
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**************@TK2MSFTNGP06.phx.gbl...
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" <mi**@beero.comwrote in message
news:Ox*************@TK2MSFTNGP06.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 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]" <No************@planet.nlwrote in message
news:OY**************@TK2MSFTNGP05.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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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

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.comwrote in message
news:ue**************@TK2MSFTNGP02.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**************@TK2MSFTNGP06.phx.gbl...
>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" <mi**@beero.comwrote in message
news:Ox*************@TK2MSFTNGP06.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 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]" <No************@planet.nlwrote in message
news:OY**************@TK2MSFTNGP05.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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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
>

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
'AllowUserToAddRows' 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**************@TK2MSFTNGP06.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.comwrote in message
news:ue**************@TK2MSFTNGP02.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**************@TK2MSFTNGP06.phx.gbl...
>>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" <mi**@beero.comwrote in message
news:Ox*************@TK2MSFTNGP06.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 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]" <No************@planet.nlwrote in message
news:OY**************@TK2MSFTNGP05.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.comwrote in message
news:Oi*************@TK2MSFTNGP06.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 "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
>>
>

Oct 20 '08 #7

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

Similar topics

0
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,...
6
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...
10
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...
3
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...
2
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...
7
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...
7
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...
0
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...
3
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.