PC Review


Reply
Thread Tools Rate Thread

Datagrid insert row removal

 
 
Tonya
Guest
Posts: n/a
 
      28th Dec 2003
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

 
Reply With Quote
 
 
 
 
Miha Markic
Guest
Posts: n/a
 
      28th Dec 2003
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:048a01c3cd5b$ce807930$(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Tonya
Guest
Posts: n/a
 
      28th Dec 2003
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 )


>-----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:048a01c3cd5b$ce807930$(E-Mail Removed)...
>> 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
>>

>
>
>.
>

 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      28th Dec 2003
Hi Tony,

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

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


"Tonya" <(E-Mail Removed)> wrote in message
news:033101c3cd64$9d56a1f0$(E-Mail Removed)...
> 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 )
>
>
> >-----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:048a01c3cd5b$ce807930$(E-Mail Removed)...
> >> 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
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
Tonya
Guest
Posts: n/a
 
      28th Dec 2003
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" <(E-Mail Removed)> wrote in

message
>news:033101c3cd64$9d56a1f0$(E-Mail Removed)...
>> 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 )
>>
>>
>> >-----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:048a01c3cd5b$ce807930$(E-Mail Removed)...
>> >> 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
>> >>
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
tonya
Guest
Posts: n/a
 
      28th Dec 2003
Hi Miha,

thx for your help. Youve been great. )
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" <(E-Mail Removed)> wrote in

>message
>>news:033101c3cd64$9d56a1f0$(E-Mail Removed)...
>>> 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 )
>>>
>>>
>>> >-----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:048a01c3cd5b$ce807930$(E-Mail Removed)...
>>> >> 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
>>> >>
>>> >
>>> >
>>> >.
>>> >

>>
>>
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert data from datagrid to datasource using insert sql statement sandeep.damodar Microsoft VB .NET 1 16th Mar 2007 12:17 PM
cd insert/removal events sanjana Microsoft C# .NET 2 11th Aug 2005 01:23 PM
usb insert/removal events sanjana Microsoft C# .NET 3 10th Aug 2005 11:40 AM
Insert from datagrid Goen Microsoft Dot NET 1 3rd Nov 2003 05:29 PM
Disabling pcmcia BEEP on pc-card insert/removal Philippe Marseille Microsoft Windows 2000 Hardware 0 30th Oct 2003 08:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:03 AM.