Change state of detached column of dataGridView.

In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged 
column,
but for detached column - I cannot change the state.

        Dim objRowV As DataRowView
        Dim objRow As DataRow

        objRowV = myBindSource.Current
        objRow = objRowV.Row
        objRow("my_column") = 123

        objRow.SetAdded() ' **** this line troughs an exception. ****

.... How can I handle this case ?

Thanks :) 

0
Mr
4/10/2010 1:00:00 PM
dotnet.languages.vb 830 articles. 0 followers. Follow

2 Replies
1695 Views

Similar Articles

[PageSpeed] 12

Am 10.04.2010 15:00, schrieb Mr. X.:
> In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged 
> column,
> but for detached column - I cannot change the state.
> 
>         Dim objRowV As DataRowView
>         Dim objRow As DataRow
> 
>         objRowV = myBindSource.Current
>         objRow = objRowV.Row
>         objRow("my_column") = 123
> 
>         objRow.SetAdded() ' **** this line troughs an exception. ****
> 
> .... How can I handle this case ?
> 
> Thanks :) 

The state "Added" means it has been added to the datatable.
Add it to a datatable and it's state will be "Added".

Otherwise it's just an existing datarow.

-- 
Armin
0
Armin
4/10/2010 1:20:57 PM
Well, thanks. It works.

Thanks :)

"Armin Zingler" <az.nospam@freenet.de> wrote in message 
news:e#2hDDL2KHA.1392@TK2MSFTNGP04.phx.gbl...
> Am 10.04.2010 15:00, schrieb Mr. X.:
>> In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged
>> column,
>> but for detached column - I cannot change the state.
>>
>>         Dim objRowV As DataRowView
>>         Dim objRow As DataRow
>>
>>         objRowV = myBindSource.Current
>>         objRow = objRowV.Row
>>         objRow("my_column") = 123
>>
>>         objRow.SetAdded() ' **** this line troughs an exception. ****
>>
>> .... How can I handle this case ?
>>
>> Thanks :)
>
> The state "Added" means it has been added to the datatable.
> Add it to a datatable and it's state will be "Added".
>
> Otherwise it's just an existing datarow.
>
> -- 
> Armin 

0
Mr
4/10/2010 1:39:04 PM
Reply:

Similar Artilces:

How to change the string value in the registry?
How to change the "string value" in the registry from the code? As there is a functionality in my application that the user can change the "string value" with some GUI. But I m not able to change it as there is a function RegReplaceKey but its only to take the backup of old file and to replace it with new one and even i dont know how to use this functin to suit my case. RegSetValue/Ex() should do it I think. -Seetharam Look at the Registry APIs. Also, take a look at my Registry class on my MVP Tips site. joe On Sun, 26 Aug 2007 23:59:33 -0700, HItz <hitesh_im...

Name change due to marriage...
I have a user who recently got married and would like to have her new married name for her emails, but also wants external users to be able to send emails to her old address until she has adequate time to inform everyone. Her new email would be something like lastname-newname, firstname instead of lastname, firstname. Should I create a new account with her new name and forward all her emails from the old account to the new one and can I copy her current pst into the new one? THanks for everyone's help. No. Just highlight her account in ADUC, and choose re-name. Make the neede...

only the first 5 columns of a 10 column excel spreadsheet sort
How do I get the whole spread sheet to sort? There is a blue lox for the first 5 columns that limits the range of the sort. How do I remove it? Using Office 2003. Maybe if you remove the Data|list Select a cell in that blue box. Data|list|convert to range jrw562 wrote: > > How do I get the whole spread sheet to sort? There is a blue lox for the > first 5 columns that limits the range of the sort. How do I remove it? > Using Office 2003. -- Dave Peterson ...

Unable to Open received PO (change to "change order")
Great Plains will not allow me to change this Purchase Order from Received to Change Order: Here is the message I get: However, if I try to enter a quantity cancelled, I get: How can I re-open this Purchase Order so I can change the price??? Thank you. Unfortunately, the pasted messages did not come through. Once a line item is received, you can change its cost only during invoice matching. The process would be to return the item; add a new row with the correct cost; and receive and invoice the new item. Not an elegant solution, for sure. -- Charles Allen, MVP &quo...

Tracked changes function misbehaving
I have a simple workbook (2002) in which the Track Changes feature is enabled. End users have reported periodic problems with the contents of cells "mysteriously" changing. In process of investigating these, have found that when tracked changes are highlighted, the comments that describe changes are not always associated with the correct cell. Example, comment on cell B114 states "Changed cell B114 from '<blank>' to '12345'". In fact, contents of cell B114 is "67890" and contents of cell B104 is actually "12345". Has anyone...

Changing font size in data validation drop-down lists
In Excel 2003, I created the value list on a separate worksheet and labled the range so I could use it in the data validation wizard on a different worksheet. The list is working fine; however, the font size in the drop-down list is too small to comfortably read. So far, I have tried: Making the font in the list larger. Formatting larger font size in the active cell with the drop-down button And, creating the list on the same worksheet. All three remedies have not increased the size of the font in the drop-down list. Suggestions are welcome. Great Optimism, Dutch Driver There is n...

Hide columns according to background fill color
I am having trouble understanding how Excel handles colors. I have a public sub that sets a public variable, "TermColor" using the RGB function. TermColor is of type MsoRGBType. In another module, I use the TermColor variable as follows: Sub WeedColsByColor(ByRef Clr, ByRef WS) Dim LastCol, i As Long With Worksheets(WS) LastCol = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count 'hide columns if they have one of the forbidden colors Debug.Print (CBool(.Cells(2, i).Interior.Color = Clr)) ...

Can there be variable size columns in one report?
I want to create a report that has 3 sub-reports of different column widths. Is this possible? -The 1st sub-report has 1 column that occupies the entire width of the page -The 2nd sub-report can fit 2 columns in the page width -The 3rd sub-report can fit 3 columns in the page width Subreports can have any number of columns that don't have to be the same from one to another. Typically your columns should display across then down in order to render properly as a subreport. -- Duane Hookom Microsoft Access MVP "SheldonHinds" wrote: > I want to create a r...

Excel date changes
I have created a spreadsheet using excel which requires the use dates on a monthly basis (similar to a calendar). The problem I have is that every month I have to go in and change the dates on the spreadsheet to reflect those of the current month before printing. Is there a way I can make it so that excel does that for me every month. Thanks, I'd really appreciate the input. Please elaborate on what the spreadsheet looks like. "phonescoop@hotmail.com" wrote: > I have created a spreadsheet using excel which requires the use dates > on a monthly basis (similar to a cal...

Change order of A/R Statements
How can I change the order in which customer statements print out of RMS? I would like to print statements sorted by company name. Currently, the statements print in some random order....I think based on CustomerID. Paul, I agree. I just had a customer tell me the same thing. They need the statements in Alphabetical order. The current order appears to be straight out of the customer table in the order they were entered. It has been posted as a suggestion - vote for it and push it higher on the "list". Claude "Paul Arenson" wrote: > How can I chang...

Changing URL from Ticker Symbol
Many of partners in Japan want to changing URL from Ticker Symbol in order to jump to a web site in Japan instead of http://moneycentral.msn.com/ . ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowse...

Excel 2003: How to make transparent columns in Excel chart?
If you create a bar plot froma given dataset you can format the columns by right clicking and choosing the desired options. In the tab that opens there is a slider which is supposed tho set the level of transparency of the column (selceted area). But so far i couldn't find a way how to use this slider. I know that there is an alternative way to get transparent bars by creating a rectangular object formating it and the use copy -> paste. But i wonder what is the slider for if you can't use it? Does anybody know have an idea? Cheers, Thomas ...

can i see the date the last time a cell was changed?
I am trying to figure out a formulla to make the date appear in one cell everytime anouther cell's data is chaged. Use a worksheet_change event to copy the cell address and put in a date stamp. -- Don Guillett SalesAid Software dguillett1@austin.rr.com "JohnNuTek" <JohnNuTek@discussions.microsoft.com> wrote in message news:5085A544-CBF4-4B81-A244-B03DE9A0E9E6@microsoft.com... >I am trying to figure out a formulla to make the date appear in one cell > everytime anouther cell's data is chaged. There really isn't a worksheet formula to do that. Typicall...

Unhandled database exception: A get/change operation on table 'Bat
During Edit Checks, we get the following message: Unhandled database exception: A get/change operation on table 'Batch_Headers' could not find a record. Then we get this message: This transaction was recovered during normal processing. You may continue processing this transaction. Any suggestions? You might want to run Check Links on payables. Before doing this, make sure you have a backup of your dynamics and company databases. Brenner -- www.KlenzmanConsulting.com "GPI" wrote: > During Edit Checks, we get the following message: > > Unhandled databas...

trouble changing data type
I am running MS Access 2007 on Windows XP Professional 2002 (SP2). I need to change the data type of a single field in a table containing just over 1.4M records in order to link it with another table and run a Make-Table Query, but Access is telling me I do not have enough memory to change the data type. I have 1GB of RAM and a Pentium 4, 2.79 GHz processor. Am I out of luck based on the equiptment I am working with, or is there a way around this? Much appreciated. -- Kevin Philadelphia, PA First backup your database. Next Compact and Repair. Third add the new field datatype. C...

Changing size and placement of maximized dialog
Hi, I want to have maximized window not on all screen. how to change maximized size and placement of dialog ? I red doc for SetWindowPlacement(&wPlac) and I have tried in OnInitDialog(): wPLac.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(&wPlac); wPlac.ptMaxPosition.x = 200; wPlac.ptMaxPosition.y = 200; SetWindowPlacement(&wPlac) But after dialog is maximized it is on all screen. What is wrong ? Peter "Peter": > I want to have maximized window not on all screen. > how to change maximized size and placement of dialog ? > I red doc for SetWindowPlaceme...

Column width
In Sheet 1 I have a certain amount of data, I want to select some cells and copy them to Sheet 2 keeping the same format. When I do this, the fonts and the colours remain unchanged, but the column width don't. I have tried paste special, but couldn't figure it out. Is this possible? Thanks in advance Regards, Emece.- --Copy range --Select the target cell and right click >PasteSpecial>All>OK --Keeping the target selection right click>PasteSpecial>select ColumnWidth>OK If this post helps click Yes --------------- Jacob Skaria "Emece"...

Add values in a column according to value in another column
How can I add the values in a column according to values in another column? If there is any value in a row in column B, I want to include the value of the corresponding row in column A. I'm flexible as to whether this is ANY value (i.e. not empty) or greater than zero. Hi Paul Maybe something like this =IF(B1="","",IF(B1>0,B1+A1)) Regards Cimjet "Paul Kaye" <paulmjkaye@gmail.com> wrote in message news:05befaf3-9ba8-48c8-aebb-654f0269d1dc@34g2000hsf.googlegroups.com... > How can I add the values in a column according to values in another > colu...

SFO error message "write protected change are not synchronized" 07-28-05
Hi! When I am changing (closing) an kalender activity from my CRM SFO klient i recieve an message that "The item is write protected in Microsoft CRM. Changes are not synchronized to the Microsoft CRM system" (translatet error message). Do you have any ide what i wrong? ...

Change the format of my footer {date} option?
I would like to show the date in my footer as January 25, 2005 instead of the default 01/25/05 Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet .PageSetup.LeftFooter = Format(Date, "mmmm dd, yyyy") End With End Sub put this in the ThisWorkbook code module. -- HTH RP (remove nothere from the email address if mailing direct) "Tori" <Tori@discussions.microsoft.com> wrote in message news:817363F1-32AB-4528-B1D6-304F8E712EA8@microsoft.com... > I would like to show the date in my footer as January 25, 2005 instead of the &g...

How do I make a column be my default column in Access
I need to make my desricption field my default field. How do I do that? Right not it defaults to my items field. me.controlname.setfocus or in macro GoToControl "controlname" Bonnie http://www.dataplus-svc.com michelle wrote: >I need to make my desricption field my default field. How do I do that? Right >not it defaults to my items field. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access/200912/1 Or, if you don't want to use events, simply set your tab order from the form design view. -- Frank H R...

Copying non-adjacent columns to adjacent rows
Hi all, I consider myself fluent in Excel, but I've developed a situation that has stumped me. Any help would be much appreciated. I might be able to solve this issue if somebody could show me how to add a number to a column. For example, if I want Excel to pull data from Column D, how can I get Excel to realize that column D is really the same thing as Column A + 3? I know you can use the column() command to get the numerical value for a column, but is there a way to have it do that in reverse, such that you could tell it the column number is 4 and it would know that you are referring...

counting dates <= 7 days ago based on criteria in a diff column
I have a spreadsheet that holds all tasks for a project. Column D holds a catagory and column Q holds the date closed. I need a formula (on a separate sheet) that counts all tasks of a specific category that were closed in the past 7 days. I already have a formula that calculates all tasks that were closed in the past 7 days, just need to add the additional criterion of the category. Hi, Try this =sumproduct((sheet1!D2:D30=A2)*((today()-sheet1!Q2:Q30)=7)) A2 on sheet2 has the specific category for which you want to count the closed tasks -- Regards, Ashish Mathur...

How do I clear a column of data without clearing the formulas?
I want to zero out a column of data, but not the subtotal formulas. How can I do that easily without going to every cell? Hi Select your column then choose edit / goto / special - constants - ok this will just select the non-formula cells then press the delete key cheers JulieD "EllenSwarts" <EllenSwarts@discussions.microsoft.com> wrote in message news:DD518142-47BC-438D-BE23-8DF1E9F72042@microsoft.com... >I want to zero out a column of data, but not the subtotal formulas. How >can > I do that easily without going to every cell? qlso look at: http://www...

excel command that counts conditions met in 2 columns?
is there a form of countif that increments only if conditions are met in two (or more) columns? e.g., countif(colA = 1 and colB = 2) Hi You need SUMPRODUCT. Have a look here for some guidance and post back if you need some more help. http://www.contextures.com/xlFunctions01.html#SumProduct Hope this helps. Andy. "brendalw" <brendalw@discussions.microsoft.com> wrote in message news:F21CD5F8-8679-4A8E-90FC-AA35657C19DC@microsoft.com... > is there a form of countif that increments only if conditions are met in > two > (or more) columns? e.g., countif(colA = 1 a...