473,396 Members | 2,023 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,396 software developers and data experts.

Datagrid insert row removal

Hi,

I wanted to know how i could get rid of the final row that
appears in a datagrid (The one where a new row can be
entered).

can anyone point me in the right direction??

thx in advance

Jul 21 '05 #1
5 2929
Hi Tonya,

You should set datasource's IBindingList.AllowNew to false.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Tonya" <gs@df> wrote in message
news:04****************************@phx.gbl...
Hi,

I wanted to know how i could get rid of the final row that
appears in a datagrid (The one where a new row can be
entered).

can anyone point me in the right direction??

thx in advance

Jul 21 '05 #2
Hi Miha,

Where do i wright this code?
my datasourse is a dataset that i created.
do i just do

dataset.ibindinglist.allownew=false
??

here ismt datagrid tht is being created....

da = New SqlDataAdapter("SELECT Meal_Type, 0 as Quantity
FROM Menu", Cn)

ds = New DataSet("MealBooking")
da.Fill(ds, "MealBooking")
DGridMealBooking.DataSource = ds.Tables(0)

Dim TSMealBooking As New DataGridTableStyle()
TSMealBooking.MappingName = "MealBooking"

Dim TCMealName As New DataGridTextBoxColumn()
TCMealName.MappingName = "Meal_Type"
TCMealName.HeaderText = "Meal Name"
TCMealName.Width = 150
TCMealName.ReadOnly = True
TSMealBooking.GridColumnStyles.Add(TCMealName)

Dim TCMealQuantity As New DataGridTextBoxColumn()
TCMealQuantity.MappingName = "Quantity"
TCMealQuantity.HeaderText = "Quantity"
TCMealQuantity.Width = 100
TCMealQuantity.ReadOnly = False
TSMealBooking.GridColumnStyles.Add(TCMealQuantity)

DGridMealBooking.TableStyles.Add(TSMealBooking)
thx for your help :o)

-----Original Message-----
Hi Tonya,

You should set datasource's IBindingList.AllowNew to false.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Tonya" <gs@df> wrote in message
news:04****************************@phx.gbl...
Hi,

I wanted to know how i could get rid of the final row that appears in a datagrid (The one where a new row can be
entered).

can anyone point me in the right direction??

thx in advance

.

Jul 21 '05 #3
Hi Tony,

ds.Tables(0).DefaultView.AllowNew = false

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
"Tonya" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Hi Miha,

Where do i wright this code?
my datasourse is a dataset that i created.
do i just do

dataset.ibindinglist.allownew=false
??

here ismt datagrid tht is being created....

da = New SqlDataAdapter("SELECT Meal_Type, 0 as Quantity
FROM Menu", Cn)

ds = New DataSet("MealBooking")
da.Fill(ds, "MealBooking")
DGridMealBooking.DataSource = ds.Tables(0)

Dim TSMealBooking As New DataGridTableStyle()
TSMealBooking.MappingName = "MealBooking"

Dim TCMealName As New DataGridTextBoxColumn()
TCMealName.MappingName = "Meal_Type"
TCMealName.HeaderText = "Meal Name"
TCMealName.Width = 150
TCMealName.ReadOnly = True
TSMealBooking.GridColumnStyles.Add(TCMealName)

Dim TCMealQuantity As New DataGridTextBoxColumn()
TCMealQuantity.MappingName = "Quantity"
TCMealQuantity.HeaderText = "Quantity"
TCMealQuantity.Width = 100
TCMealQuantity.ReadOnly = False
TSMealBooking.GridColumnStyles.Add(TCMealQuantity)

DGridMealBooking.TableStyles.Add(TSMealBooking)
thx for your help :o)

-----Original Message-----
Hi Tonya,

You should set datasource's IBindingList.AllowNew to

false.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Tonya" <gs@df> wrote in message
news:04****************************@phx.gbl...
Hi,

I wanted to know how i could get rid of the final row that appears in a datagrid (The one where a new row can be
entered).

can anyone point me in the right direction??

thx in advance

.

Jul 21 '05 #4
Hi Miha,

I have tried this but i keep getting an error stating....
An unhandled exception of type 'System.Exception'
occurred in system.windows.forms.dll
Additional information: Complex DataBinding accepts as a
data source either an IList or an IListSource

the application stops at this line...
DGridMealBooking.DataSource =
ds.Tables(0).DefaultView.AllowNew = False

any ideas on how to resolve this?
-----Original Message-----
Hi Tony,

ds.Tables(0).DefaultView.AllowNew = false

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
"Tonya" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Hi Miha,

Where do i wright this code?
my datasourse is a dataset that i created.
do i just do

dataset.ibindinglist.allownew=false
??

here ismt datagrid tht is being created....

da = New SqlDataAdapter("SELECT Meal_Type, 0 as Quantity FROM Menu", Cn)

ds = New DataSet("MealBooking")
da.Fill(ds, "MealBooking")
DGridMealBooking.DataSource = ds.Tables(0)

Dim TSMealBooking As New DataGridTableStyle()
TSMealBooking.MappingName = "MealBooking"

Dim TCMealName As New DataGridTextBoxColumn()
TCMealName.MappingName = "Meal_Type"
TCMealName.HeaderText = "Meal Name"
TCMealName.Width = 150
TCMealName.ReadOnly = True
TSMealBooking.GridColumnStyles.Add(TCMealName)

Dim TCMealQuantity As New DataGridTextBoxColumn()
TCMealQuantity.MappingName = "Quantity"
TCMealQuantity.HeaderText = "Quantity"
TCMealQuantity.Width = 100
TCMealQuantity.ReadOnly = False
TSMealBooking.GridColumnStyles.Add(TCMealQuantity)

DGridMealBooking.TableStyles.Add(TSMealBooking)
thx for your help :o)

>-----Original Message-----
>Hi Tonya,
>
>You should set datasource's IBindingList.AllowNew to

false.
>
>--
>Miha Markic - RightHand .NET consulting & development
>miha at rthand com
>www.rhand.com
>
>"Tonya" <gs@df> wrote in message
>news:04****************************@phx.gbl...
>> Hi,
>>
>> I wanted to know how i could get rid of the final row
that
>> appears in a datagrid (The one where a new row can

be >> entered).
>>
>> can anyone point me in the right direction??
>>
>> thx in advance
>>
>
>
>.
>

.

Jul 21 '05 #5
Hi Miha,

thx for your help. Youve been great. :o)
I have just relised what i was doing wrong.

Thx again

Tonya
-----Original Message-----
Hi Miha,

I have tried this but i keep getting an error stating....
An unhandled exception of type 'System.Exception'
occurred in system.windows.forms.dll
Additional information: Complex DataBinding accepts as a
data source either an IList or an IListSource

the application stops at this line...
DGridMealBooking.DataSource =
ds.Tables(0).DefaultView.AllowNew = False

any ideas on how to resolve this?
-----Original Message-----
Hi Tony,

ds.Tables(0).DefaultView.AllowNew = false

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com
"Tonya" <an*******@discussions.microsoft.com> wrote in

message
news:03****************************@phx.gbl...
Hi Miha,

Where do i wright this code?
my datasourse is a dataset that i created.
do i just do

dataset.ibindinglist.allownew=false
??

here ismt datagrid tht is being created....

da = New SqlDataAdapter("SELECT Meal_Type, 0 asQuantity FROM Menu", Cn)

ds = New DataSet("MealBooking")
da.Fill(ds, "MealBooking")
DGridMealBooking.DataSource = ds.Tables(0)

Dim TSMealBooking As New DataGridTableStyle()
TSMealBooking.MappingName = "MealBooking"

Dim TCMealName As New DataGridTextBoxColumn()
TCMealName.MappingName = "Meal_Type"
TCMealName.HeaderText = "Meal Name"
TCMealName.Width = 150
TCMealName.ReadOnly = True
TSMealBooking.GridColumnStyles.Add(TCMealName)

Dim TCMealQuantity As New DataGridTextBoxColumn()
TCMealQuantity.MappingName = "Quantity"
TCMealQuantity.HeaderText = "Quantity"
TCMealQuantity.Width = 100
TCMealQuantity.ReadOnly = False
TSMealBooking.GridColumnStyles.Add(TCMealQuantity)

DGridMealBooking.TableStyles.Add(TSMealBooking)
thx for your help :o)
>-----Original Message-----
>Hi Tonya,
>
>You should set datasource's IBindingList.AllowNew to
false.
>
>--
>Miha Markic - RightHand .NET consulting & development
>miha at rthand com
>www.rhand.com
>
>"Tonya" <gs@df> wrote in message
>news:04****************************@phx.gbl...
>> Hi,
>>
>> I wanted to know how i could get rid of the finalrow that
>> appears in a datagrid (The one where a new row canbe >> entered).
>>
>> can anyone point me in the right direction??
>>
>> thx in advance
>>
>
>
>.
>

.

.

Jul 21 '05 #6

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

Similar topics

7
by: Pierluigi Terzoli | last post by:
Hi everybody, I need help for this problem: I'm using a DataGrid to Insert/Modify/Cancel data from a single table. At the moment, every cell modification of a pre-existing row is correctly update...
0
by: Christopher | last post by:
I AM GETTING A SYSTEM.DATA.SQLCLIENT.SQLEXCEPTION ERROR WHEN ATTEMPTING TO INSERT DATA INTO A SINGLE TABLE THROUGH A GRID //If this is due to a spelling error, i will //inflict a ritual...
3
by: sanjana | last post by:
hi willy i have done the code for detecting insertion/removal of device at USB port thanx for ur advice but is there way to detect if sd card is inserted or removed from the device at usb tht...
1
by: Alex | last post by:
I found some good information On Multi-row Editing in the ASP.NET DataGrid at this site http://www.dedicatedsolutions.co.uk/DesktopDefault.aspx?tabid=62 It is worth the click
1
by: tshad | last post by:
I can't seem to get insert into a DataGrid to work. I am using an example from the net and made changes to work on my computer. The grid comes up fine. The edit boxes in the footer are there. ...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
5
by: Tonya | last post by:
Hi, I wanted to know how i could get rid of the final row that appears in a datagrid (The one where a new row can be entered). can anyone point me in the right direction?? thx in advance
5
by: rcoco | last post by:
Hi, I'm working on a asp.net project with a datagrid. I want the user to be adding data into Sql database using the datagrid. So I'm using a ListBox to do this and edit update and delete. I placed...
5
by: Me LK | last post by:
I need to add a line to choose a size into a dropdown . Since I have the dropdown nested inside a datagrid this is not working.When a page displays there are several rows of dropdowns but only the...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...
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,...
0
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...
0
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,...

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.