By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,387 Members | 1,729 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,387 IT Pros & Developers. It's quick & easy.

DataGridView new row

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.