Datagrid insert row removal

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tonya

    #1

    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

  • Miha Markic

    #2
    Re: Datagrid insert row removal

    Hi Tonya,

    You should set datasource's IBindingList.Al lowNew to false.

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


    "Tonya" <gs@df> wrote in message
    news:048a01c3cd 5b$ce807930$a60 1280a@phx.gbl.. .[color=blue]
    > 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
    >[/color]


    Comment

    • Tonya

      #3
      Re: Datagrid insert row removal

      Hi Miha,

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

      dataset.ibindin glist.allownew= false
      ??

      here ismt datagrid tht is being created....

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

      ds = New DataSet("MealBo oking")
      da.Fill(ds, "MealBookin g")
      DGridMealBookin g.DataSource = ds.Tables(0)

      Dim TSMealBooking As New DataGridTableSt yle()
      TSMealBooking.M appingName = "MealBookin g"

      Dim TCMealName As New DataGridTextBox Column()
      TCMealName.Mapp ingName = "Meal_Type"
      TCMealName.Head erText = "Meal Name"
      TCMealName.Widt h = 150
      TCMealName.Read Only = True
      TSMealBooking.G ridColumnStyles .Add(TCMealName )

      Dim TCMealQuantity As New DataGridTextBox Column()
      TCMealQuantity. MappingName = "Quantity"
      TCMealQuantity. HeaderText = "Quantity"
      TCMealQuantity. Width = 100
      TCMealQuantity. ReadOnly = False
      TSMealBooking.G ridColumnStyles .Add(TCMealQuan tity)

      DGridMealBookin g.TableStyles.A dd(TSMealBookin g)


      thx for your help :o)

      [color=blue]
      >-----Original Message-----
      >Hi Tonya,
      >
      >You should set datasource's IBindingList.Al lowNew to[/color]
      false.[color=blue]
      >
      >--
      >Miha Markic - RightHand .NET consulting & development
      >miha at rthand com
      >www.rhand.com
      >
      >"Tonya" <gs@df> wrote in message
      >news:048a01c3c d5b$ce807930$a6 01280a@phx.gbl. ..[color=green]
      >> Hi,
      >>
      >> I wanted to know how i could get rid of the final row[/color][/color]
      that[color=blue][color=green]
      >> appears in a datagrid (The one where a new row can be
      >> entered).
      >>
      >> can anyone point me in the right direction??
      >>
      >> thx in advance
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      • Miha Markic

        #4
        Re: Datagrid insert row removal

        Hi Tony,

        ds.Tables(0).De faultView.Allow New = false

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



        "Tonya" <anonymous@disc ussions.microso ft.com> wrote in message
        news:033101c3cd 64$9d56a1f0$a00 1280a@phx.gbl.. .[color=blue]
        > Hi Miha,
        >
        > Where do i wright this code?
        > my datasourse is a dataset that i created.
        > do i just do
        >
        > dataset.ibindin glist.allownew= false
        > ??
        >
        > here ismt datagrid tht is being created....
        >
        > da = New SqlDataAdapter( "SELECT Meal_Type, 0 as Quantity
        > FROM Menu", Cn)
        >
        > ds = New DataSet("MealBo oking")
        > da.Fill(ds, "MealBookin g")
        > DGridMealBookin g.DataSource = ds.Tables(0)
        >
        > Dim TSMealBooking As New DataGridTableSt yle()
        > TSMealBooking.M appingName = "MealBookin g"
        >
        > Dim TCMealName As New DataGridTextBox Column()
        > TCMealName.Mapp ingName = "Meal_Type"
        > TCMealName.Head erText = "Meal Name"
        > TCMealName.Widt h = 150
        > TCMealName.Read Only = True
        > TSMealBooking.G ridColumnStyles .Add(TCMealName )
        >
        > Dim TCMealQuantity As New DataGridTextBox Column()
        > TCMealQuantity. MappingName = "Quantity"
        > TCMealQuantity. HeaderText = "Quantity"
        > TCMealQuantity. Width = 100
        > TCMealQuantity. ReadOnly = False
        > TSMealBooking.G ridColumnStyles .Add(TCMealQuan tity)
        >
        > DGridMealBookin g.TableStyles.A dd(TSMealBookin g)
        >
        >
        > thx for your help :o)
        >
        >[color=green]
        > >-----Original Message-----
        > >Hi Tonya,
        > >
        > >You should set datasource's IBindingList.Al lowNew to[/color]
        > false.[color=green]
        > >
        > >--
        > >Miha Markic - RightHand .NET consulting & development
        > >miha at rthand com
        > >www.rhand.com
        > >
        > >"Tonya" <gs@df> wrote in message
        > >news:048a01c3c d5b$ce807930$a6 01280a@phx.gbl. ..[color=darkred]
        > >> Hi,
        > >>
        > >> I wanted to know how i could get rid of the final row[/color][/color]
        > that[color=green][color=darkred]
        > >> appears in a datagrid (The one where a new row can be
        > >> entered).
        > >>
        > >> can anyone point me in the right direction??
        > >>
        > >> thx in advance
        > >>[/color]
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        • Tonya

          #5
          Re: Datagrid insert row removal

          Hi Miha,

          I have tried this but i keep getting an error stating....
          An unhandled exception of type 'System.Excepti on'
          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...
          DGridMealBookin g.DataSource =
          ds.Tables(0).De faultView.Allow New = False

          any ideas on how to resolve this?[color=blue]
          >-----Original Message-----
          >Hi Tony,
          >
          >ds.Tables(0).D efaultView.Allo wNew = false
          >
          >--
          >Miha Markic - RightHand .NET consulting & development
          >miha at rthand com
          >www.rhand.com
          >
          >
          >"Tonya" <anonymous@disc ussions.microso ft.com> wrote in[/color]
          message[color=blue]
          >news:033101c3c d64$9d56a1f0$a0 01280a@phx.gbl. ..[color=green]
          >> Hi Miha,
          >>
          >> Where do i wright this code?
          >> my datasourse is a dataset that i created.
          >> do i just do
          >>
          >> dataset.ibindin glist.allownew= false
          >> ??
          >>
          >> here ismt datagrid tht is being created....
          >>
          >> da = New SqlDataAdapter( "SELECT Meal_Type, 0 as[/color][/color]
          Quantity[color=blue][color=green]
          >> FROM Menu", Cn)
          >>
          >> ds = New DataSet("MealBo oking")
          >> da.Fill(ds, "MealBookin g")
          >> DGridMealBookin g.DataSource = ds.Tables(0)
          >>
          >> Dim TSMealBooking As New DataGridTableSt yle()
          >> TSMealBooking.M appingName = "MealBookin g"
          >>
          >> Dim TCMealName As New DataGridTextBox Column()
          >> TCMealName.Mapp ingName = "Meal_Type"
          >> TCMealName.Head erText = "Meal Name"
          >> TCMealName.Widt h = 150
          >> TCMealName.Read Only = True
          >> TSMealBooking.G ridColumnStyles .Add(TCMealName )
          >>
          >> Dim TCMealQuantity As New DataGridTextBox Column()
          >> TCMealQuantity. MappingName = "Quantity"
          >> TCMealQuantity. HeaderText = "Quantity"
          >> TCMealQuantity. Width = 100
          >> TCMealQuantity. ReadOnly = False
          >> TSMealBooking.G ridColumnStyles .Add(TCMealQuan tity)
          >>
          >> DGridMealBookin g.TableStyles.A dd(TSMealBookin g)
          >>
          >>
          >> thx for your help :o)
          >>
          >>[color=darkred]
          >> >-----Original Message-----
          >> >Hi Tonya,
          >> >
          >> >You should set datasource's IBindingList.Al lowNew to[/color]
          >> false.[color=darkred]
          >> >
          >> >--
          >> >Miha Markic - RightHand .NET consulting & development
          >> >miha at rthand com
          >> >www.rhand.com
          >> >
          >> >"Tonya" <gs@df> wrote in message
          >> >news:048a01c3c d5b$ce807930$a6 01280a@phx.gbl. ..
          >> >> Hi,
          >> >>
          >> >> I wanted to know how i could get rid of the final[/color][/color][/color]
          row[color=blue][color=green]
          >> that[color=darkred]
          >> >> appears in a datagrid (The one where a new row can[/color][/color][/color]
          be[color=blue][color=green][color=darkred]
          >> >> entered).
          >> >>
          >> >> can anyone point me in the right direction??
          >> >>
          >> >> thx in advance
          >> >>
          >> >
          >> >
          >> >.
          >> >[/color][/color]
          >
          >
          >.
          >[/color]

          Comment

          • tonya

            #6
            Re: Datagrid insert row removal

            Hi Miha,

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

            Thx again

            Tonya
            [color=blue]
            >-----Original Message-----
            >Hi Miha,
            >
            >I have tried this but i keep getting an error stating....
            >An unhandled exception of type 'System.Excepti on'
            >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...
            >DGridMealBooki ng.DataSource =
            > ds.Tables(0).De faultView.Allow New = False
            >
            >any ideas on how to resolve this?[color=green]
            >>-----Original Message-----
            >>Hi Tony,
            >>
            >>ds.Tables(0). DefaultView.All owNew = false
            >>
            >>--
            >>Miha Markic - RightHand .NET consulting & development
            >>miha at rthand com
            >>www.rhand.com
            >>
            >>
            >>"Tonya" <anonymous@disc ussions.microso ft.com> wrote in[/color]
            >message[color=green]
            >>news:033101c3 cd64$9d56a1f0$a 001280a@phx.gbl ...[color=darkred]
            >>> Hi Miha,
            >>>
            >>> Where do i wright this code?
            >>> my datasourse is a dataset that i created.
            >>> do i just do
            >>>
            >>> dataset.ibindin glist.allownew= false
            >>> ??
            >>>
            >>> here ismt datagrid tht is being created....
            >>>
            >>> da = New SqlDataAdapter( "SELECT Meal_Type, 0 as[/color][/color]
            >Quantity[color=green][color=darkred]
            >>> FROM Menu", Cn)
            >>>
            >>> ds = New DataSet("MealBo oking")
            >>> da.Fill(ds, "MealBookin g")
            >>> DGridMealBookin g.DataSource = ds.Tables(0)
            >>>
            >>> Dim TSMealBooking As New DataGridTableSt yle()
            >>> TSMealBooking.M appingName = "MealBookin g"
            >>>
            >>> Dim TCMealName As New DataGridTextBox Column()
            >>> TCMealName.Mapp ingName = "Meal_Type"
            >>> TCMealName.Head erText = "Meal Name"
            >>> TCMealName.Widt h = 150
            >>> TCMealName.Read Only = True
            >>> TSMealBooking.G ridColumnStyles .Add(TCMealName )
            >>>
            >>> Dim TCMealQuantity As New DataGridTextBox Column()
            >>> TCMealQuantity. MappingName = "Quantity"
            >>> TCMealQuantity. HeaderText = "Quantity"
            >>> TCMealQuantity. Width = 100
            >>> TCMealQuantity. ReadOnly = False
            >>> TSMealBooking.G ridColumnStyles .Add(TCMealQuan tity)
            >>>
            >>> DGridMealBookin g.TableStyles.A dd(TSMealBookin g)
            >>>
            >>>
            >>> thx for your help :o)
            >>>
            >>>
            >>> >-----Original Message-----
            >>> >Hi Tonya,
            >>> >
            >>> >You should set datasource's IBindingList.Al lowNew to
            >>> false.
            >>> >
            >>> >--
            >>> >Miha Markic - RightHand .NET consulting & development
            >>> >miha at rthand com
            >>> >www.rhand.com
            >>> >
            >>> >"Tonya" <gs@df> wrote in message
            >>> >news:048a01c3c d5b$ce807930$a6 01280a@phx.gbl. ..
            >>> >> Hi,
            >>> >>
            >>> >> I wanted to know how i could get rid of the final[/color][/color]
            >row[color=green][color=darkred]
            >>> that
            >>> >> appears in a datagrid (The one where a new row can[/color][/color]
            >be[color=green][color=darkred]
            >>> >> entered).
            >>> >>
            >>> >> can anyone point me in the right direction??
            >>> >>
            >>> >> thx in advance
            >>> >>
            >>> >
            >>> >
            >>> >.
            >>> >[/color]
            >>
            >>
            >>.
            >>[/color]
            >.
            >[/color]

            Comment

            Working...