![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Simple Datagrid question Simple perhaps to you - but not to me. :-) Here is a quick question I just cant seem to find a solution for. (im using vb.net but i dont think that matters in this case). I created a dummy datagrid - linked to a dataset. on it are 3 columns: date, combobox, checkbox now...go to a current record and click the comobo box and drop down to a new item in the list. selecting that list, the record goes into 'edit mode ( left pencil in the datagrid view ). Now if I hit my 'save' button right now, it doesnt actaully save that change. It will save it if I hit 'enter' or 'tab' first. ( Pencil turns back to black arrow ) Is this normal of a .net datagrid ? Is there anyway around it - some code i can put somewhere so i dont click a dropdown, and hit save right away, but really I havnt changed the field column yet until I hit the enter key or tab key or click to another field / column / record. Hope that makes sense. Thanks Miro |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Simple Datagrid question Found it - i think I must put this code wherever I want it to take the current input ( still in edit mode ) of a cell. DataGrid.endedit() Miro "Miro" <miro@xxxxxx> wrote in message news:OUcXxQafJHA.4728@xxxxxx Quote: > Simple perhaps to you - but not to me. :-) > > Here is a quick question I just cant seem to find a solution for. (im > using vb.net but i dont think that matters in this case). > > I created a dummy datagrid - linked to a dataset. > on it are 3 columns: > > date, combobox, checkbox > > now...go to a current record and click the comobo box and drop down to a > new item in the list. > selecting that list, the record goes into 'edit mode ( left pencil in the > datagrid view ). > > Now if I hit my 'save' button right now, it doesnt actaully save that > change. > It will save it if I hit 'enter' or 'tab' first. ( Pencil turns back to > black arrow ) > > Is this normal of a .net datagrid ? > Is there anyway around it - some code i can put somewhere so i dont click > a dropdown, and hit save right away, but really I havnt changed the field > column yet until I hit the enter key or tab key or click to another field > / column / record. > > Hope that makes sense. > > Thanks > > Miro |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Simple Datagrid question And as well to finish off this post I had to add this: BindingContext(MyBindingSource).EndCurrentEdit() to keep the last 'added' line to the binding source as well. Im still trying to read up on 'BindingContext' on what it actually does but those two lines of code did the trick for me. Cheers' - sorry for all the posts. Miro "Miro" <miro@xxxxxx> wrote in message news:umw2qWafJHA.1292@xxxxxx Quote: > Found it - i think > > I must put this code wherever I want it to take the current input ( still > in edit mode ) of a cell. > > DataGrid.endedit() > > Miro > > "Miro" <miro@xxxxxx> wrote in message > news:OUcXxQafJHA.4728@xxxxxx Quote: >> Simple perhaps to you - but not to me. :-) >> >> Here is a quick question I just cant seem to find a solution for. (im >> using vb.net but i dont think that matters in this case). >> >> I created a dummy datagrid - linked to a dataset. >> on it are 3 columns: >> >> date, combobox, checkbox >> >> now...go to a current record and click the comobo box and drop down to a >> new item in the list. >> selecting that list, the record goes into 'edit mode ( left pencil in the >> datagrid view ). >> >> Now if I hit my 'save' button right now, it doesnt actaully save that >> change. >> It will save it if I hit 'enter' or 'tab' first. ( Pencil turns back to >> black arrow ) >> >> Is this normal of a .net datagrid ? >> Is there anyway around it - some code i can put somewhere so i dont click >> a dropdown, and hit save right away, but really I havnt changed the field >> column yet until I hit the enter key or tab key or click to another field >> / column / record. >> >> Hope that makes sense. >> >> Thanks >> >> Miro |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Simple Datagrid question Miro, I thought the latter was not anymore necessary in versions behind 2003, endedit should be enough. Cor "Miro" <miro@xxxxxx> wrote in message news:eR%23kdfafJHA.5844@xxxxxx Quote: > And as well to finish off this post I had to add this: > > BindingContext(MyBindingSource).EndCurrentEdit() > to keep the last 'added' line to the binding source as well. > > Im still trying to read up on 'BindingContext' on what it actually does > but those two lines of code did the trick for me. > > Cheers' - sorry for all the posts. > > Miro > > "Miro" <miro@xxxxxx> wrote in message > news:umw2qWafJHA.1292@xxxxxx Quote: >> Found it - i think >> >> I must put this code wherever I want it to take the current input ( still >> in edit mode ) of a cell. >> >> DataGrid.endedit() >> >> Miro >> >> "Miro" <miro@xxxxxx> wrote in message >> news:OUcXxQafJHA.4728@xxxxxx Quote: >>> Simple perhaps to you - but not to me. :-) >>> >>> Here is a quick question I just cant seem to find a solution for. (im >>> using vb.net but i dont think that matters in this case). >>> >>> I created a dummy datagrid - linked to a dataset. >>> on it are 3 columns: >>> >>> date, combobox, checkbox >>> >>> now...go to a current record and click the comobo box and drop down to a >>> new item in the list. >>> selecting that list, the record goes into 'edit mode ( left pencil in >>> the datagrid view ). >>> >>> Now if I hit my 'save' button right now, it doesnt actaully save that >>> change. >>> It will save it if I hit 'enter' or 'tab' first. ( Pencil turns back to >>> black arrow ) >>> >>> Is this normal of a .net datagrid ? >>> Is there anyway around it - some code i can put somewhere so i dont >>> click a dropdown, and hit save right away, but really I havnt changed >>> the field column yet until I hit the enter key or tab key or click to >>> another field / column / record. >>> >>> Hope that makes sense. >>> >>> Thanks >>> >>> Miro |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Simple Datagrid question You are correct (it worked with the first line)- but I had to add that so when the datagridview automatically adds the next row - it stays as well. Hard to know what to google for when you dont know what to google for ![]() I found the first line DataGrid.endedit() allowed the changed cell to stay... and this line: BindingContext(MyBindingSource).EndCurrentEdit() Kept the automatic line added by automatic addrows in the datagrid when a save was done. Cheers' Miro "Cor Ligthert[MVP]" <Notmyfirstname@xxxxxx> wrote in message news:OmcNiEgfJHA.1252@xxxxxx Quote: > Miro, > > I thought the latter was not anymore necessary in versions behind 2003, > endedit should be enough. > > Cor > > "Miro" <miro@xxxxxx> wrote in message > news:eR%23kdfafJHA.5844@xxxxxx Quote: >> And as well to finish off this post I had to add this: >> >> BindingContext(MyBindingSource).EndCurrentEdit() >> to keep the last 'added' line to the binding source as well. >> >> Im still trying to read up on 'BindingContext' on what it actually does >> but those two lines of code did the trick for me. >> >> Cheers' - sorry for all the posts. >> >> Miro >> >> "Miro" <miro@xxxxxx> wrote in message >> news:umw2qWafJHA.1292@xxxxxx Quote: >>> Found it - i think >>> >>> I must put this code wherever I want it to take the current input ( >>> still in edit mode ) of a cell. >>> >>> DataGrid.endedit() >>> >>> Miro >>> >>> "Miro" <miro@xxxxxx> wrote in message >>> news:OUcXxQafJHA.4728@xxxxxx >>>> Simple perhaps to you - but not to me. :-) >>>> >>>> Here is a quick question I just cant seem to find a solution for. (im >>>> using vb.net but i dont think that matters in this case). >>>> >>>> I created a dummy datagrid - linked to a dataset. >>>> on it are 3 columns: >>>> >>>> date, combobox, checkbox >>>> >>>> now...go to a current record and click the comobo box and drop down to >>>> a new item in the list. >>>> selecting that list, the record goes into 'edit mode ( left pencil in >>>> the datagrid view ). >>>> >>>> Now if I hit my 'save' button right now, it doesnt actaully save that >>>> change. >>>> It will save it if I hit 'enter' or 'tab' first. ( Pencil turns back >>>> to black arrow ) >>>> >>>> Is this normal of a .net datagrid ? >>>> Is there anyway around it - some code i can put somewhere so i dont >>>> click a dropdown, and hit save right away, but really I havnt changed >>>> the field column yet until I hit the enter key or tab key or click to >>>> another field / column / record. >>>> >>>> Hope that makes sense. >>>> >>>> Thanks >>>> >>>> Miro >>> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| DataGrid Question | .NET General | |||
| DataGrid Question | .NET General | |||
| Simple question | .NET General | |||
| simple question... really! | Vista General | |||
| a simple question | Vista General | |||