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

preserve datarow number

P: n/a

When a user types in values in last
row of DataGrid, new row is
automatically added below.
In certain cases I would like
to preserve constant number
of rows and prevent a new
row to be automatically added
at the bottom. Is this possible/how?

--
Strah @ Langan
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Create a dataview from your data. Bind the dataview to the datagrid.
The dataview has an allownew property.

Dim conn As OleDbConnection

Dim strConn As String

Dim strSQL As String

Dim ds As New DataSet

Dim da As OleDbDataAdapter

Dim dv As DataView

Dim cm As CurrencyManager

Dim iRow As Integer

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn += "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * from Orders", conn)

da.Fill(ds, "Customers")

dv = New DataView(ds.Tables("Customers"))

DataGrid1.DataSource = dv

dv.AllowNew = False

Ken
---------------------
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:ea**************@TK2MSFTNGP09.phx.gbl...

When a user types in values in last
row of DataGrid, new row is
automatically added below.
In certain cases I would like
to preserve constant number
of rows and prevent a new
row to be automatically added
at the bottom. Is this possible/how?

--
Strah @ Langan

Nov 20 '05 #2

P: n/a
Ken,
you are irreplaceable,
much obliged for your
prompt and accurate
response!
--
Strah @ Langan

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
Hi,

Create a dataview from your data. Bind the dataview to the datagrid.
The dataview has an allownew property.

Dim conn As OleDbConnection

Dim strConn As String

Dim strSQL As String

Dim ds As New DataSet

Dim da As OleDbDataAdapter

Dim dv As DataView

Dim cm As CurrencyManager

Dim iRow As Integer

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn += "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * from Orders", conn)

da.Fill(ds, "Customers")

dv = New DataView(ds.Tables("Customers"))

DataGrid1.DataSource = dv

dv.AllowNew = False

Ken
---------------------
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:ea**************@TK2MSFTNGP09.phx.gbl...

When a user types in values in last
row of DataGrid, new row is
automatically added below.
In certain cases I would like
to preserve constant number
of rows and prevent a new
row to be automatically added
at the bottom. Is this possible/how?

--
Strah @ Langan


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.