Click here to Skip to main content
15,908,444 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionIs there any application block for personalization for winforms of .net framework 1.1 ? Pin
Kent Liu31-May-06 23:41
professionalKent Liu31-May-06 23:41 
AnswerRe: Is there any application block for personalization for winforms of .net framework 1.1 ? Pin
Ed.Poore2-Jun-06 14:00
Ed.Poore2-Jun-06 14:00 
Questionarchitecture/design of the component 'System.Web.Mail' Pin
Ashuu31-May-06 23:28
Ashuu31-May-06 23:28 
AnswerRe: architecture/design of the component 'System.Web.Mail' Pin
Ed.Poore2-Jun-06 14:05
Ed.Poore2-Jun-06 14:05 
QuestionUsing C# DLL on another mechine Pin
Sanjeet Sachan31-May-06 22:16
Sanjeet Sachan31-May-06 22:16 
AnswerRe: Using C# DLL on another mechine Pin
Stephan Samuel1-Jun-06 6:51
Stephan Samuel1-Jun-06 6:51 
GeneralRe: Using C# DLL on another mechine Pin
Ed.Poore2-Jun-06 14:01
Ed.Poore2-Jun-06 14:01 
QuestionIs there a way to change the original value in the DataRow? Pin
NewSilence31-May-06 21:17
NewSilence31-May-06 21:17 
Is there any way to change the original value in the DataRow?

DataRow.Item(0) may have modified/current value and its original value. I need to change its original value like row.Item("ColumnName", DataRowVersion.Original) = "NewValue". But this property is for read only any.

Ideas?

I have found the way but I don't like it and it looks like a hack.

Here's the code:
<br />
	Public Function SetRowOriginalItemValue(ByVal primaryKeyColumn As DataColumn, ByVal key As Object, ByVal editColumn As DataColumn, ByVal value As Object) As Boolean<br />
		'Utils.Assert.ArgumentCheckForNullReference(primaryKeyColumn, "primaryKeyColumn")<br />
		'Utils.Assert.ArgumentCheckForNullReference(key, "key")<br />
		'Utils.Assert.ArgumentCheckForNullReference(editColumn, "editColumn")<br />
		'Utils.Assert.ArgumentCheckExpectedType(key, primaryKeyColumn.DataType)<br />
		'Utils.Assert.ArgumentCheckExpectedType(value, editColumn.DataType)<br />
		Dim t As DataTable = editColumn.Table<br />
		Dim d As DataSet = t.DataSet<br />
		Dim s As New IO.MemoryStream<br />
		d.WriteXml(s, XmlWriteMode.DiffGram)<br />
		s.Seek(0, IO.SeekOrigin.Begin)<br />
		Dim doc As New Xml.XmlDocument<br />
		doc.Load(s)<br />
		Dim nsmgr As Xml.XmlNamespaceManager = New Xml.XmlNamespaceManager(doc.NameTable)<br />
		nsmgr.AddNamespace("diffgr", "urn:schemas-microsoft-com:xml-diffgram-v1")<br />
		nsmgr.AddNamespace("my", d.Namespace)<br />
		Dim xp As String = String.Format(New Globalization.CultureInfo("en-US"), _<br />
		 "/diffgr:diffgram/diffgr:before/my:{0}[starts-with(@diffgr:id, '{0}')]/my:{1}[text()='{2}']/../my:{3}/node()", _<br />
		  t.TableName, primaryKeyColumn.ColumnName, key, editColumn.ColumnName)<br />
		Dim n As Xml.XmlNode = doc.DocumentElement.SelectSingleNode(xp, nsmgr)<br />
		If Not n Is Nothing Then<br />
			n.Value = value<br />
			d.Clear()<br />
			d.ReadXml(New IO.StringReader(doc.InnerXml), XmlReadMode.DiffGram)<br />
			Return True<br />
		End If<br />
		Return False<br />
	End Function<br />
<br />
''''''''''''''''''''<br />
<br />
	Sub SetRowOriginalItemValueTest()<br />
		Dim d As New DistrictSet<br />
		Dim row As DistrictSet.DistrictsRow<br />
		row = d.Districts.NewDistrictsRow<br />
		row.DistrictId = 109901<br />
		row.DistrictName = "Orange County"<br />
		d.Districts.AddDistrictsRow(row)<br />
		d.AcceptChanges()<br />
<br />
		d.Districts(0).DistrictName = "West Coast"<br />
<br />
		Diagnostics.Trace.WriteLine("Current: " & d.Districts.Item(0)("DistrictName"))<br />
		Diagnostics.Trace.WriteLine("Original before SetRowOriginalItemValue(): " & d.Districts.Item(0)("DistrictName", DataRowVersion.Original))<br />
<br />
		SetRowOriginalItemValue(d.Districts.DistrictIdColumn, 109901, d.Districts.DistrictNameColumn, "Northeast")<br />
<br />
		Diagnostics.Trace.WriteLine("Original after SetRowOriginalItemValue(): " & d.Districts.Item(0)("DistrictName", DataRowVersion.Original))<br />
	End Sub<br />


Output is:
Current: West Coast
Original before SetRowOriginalItemValue(): Orange County
Original after SetRowOriginalItemValue(): Northeast
AnswerRe: Is there a way to change the original value in the DataRow? Pin
ApurvaShah1-Jun-06 11:47
ApurvaShah1-Jun-06 11:47 
QuestionJavascript Scripting Engine for application framework? Pin
copper000231-May-06 3:05
copper000231-May-06 3:05 
AnswerRe: Javascript Scripting Engine for application framework? Pin
Dustin Metzgar31-May-06 3:57
Dustin Metzgar31-May-06 3:57 
QuestionHow to call Visual Studio Command Prompt in VB.NET Pin
asifhameed131-May-06 2:13
asifhameed131-May-06 2:13 
AnswerRe: How to call Visual Studio Command Prompt in VB.NET Pin
Craig Gilchrist31-May-06 2:32
Craig Gilchrist31-May-06 2:32 
GeneralRe: How to call Visual Studio Command Prompt in VB.NET Pin
asifhameed131-May-06 3:40
asifhameed131-May-06 3:40 
GeneralRe: How to call Visual Studio Command Prompt in VB.NET Pin
Craig Gilchrist31-May-06 3:47
Craig Gilchrist31-May-06 3:47 
QuestionPRoblem while adding field to the data set of reports(.rdl) Pin
kiran015331-May-06 2:01
kiran015331-May-06 2:01 
Questionadding fields to the dataset of report in .net reports project Pin
kiran015331-May-06 0:07
kiran015331-May-06 0:07 
Question.NET dependent executables [modified] Pin
Imtiaz Murtaza30-May-06 21:42
Imtiaz Murtaza30-May-06 21:42 
AnswerRe: .NET dependent executables [modified] Pin
leppie31-May-06 2:41
leppie31-May-06 2:41 
GeneralRe: .NET dependent executables [modified] Pin
Imtiaz Murtaza31-May-06 3:00
Imtiaz Murtaza31-May-06 3:00 
GeneralRe: .NET dependent executables [modified] Pin
leppie31-May-06 6:21
leppie31-May-06 6:21 
QuestionAddIn not responding in VS.Net 2003 Pin
Ruhina30-May-06 2:53
Ruhina30-May-06 2:53 
QuestionWebBrowser control and Flash in .NET Compact Framework Pin
jseiler29-May-06 21:55
jseiler29-May-06 21:55 
QuestionSerial Port Data Received Events Pin
elcheah29-May-06 14:44
elcheah29-May-06 14:44 
AnswerRe: Serial Port Data Received Events Pin
Office Lineman30-May-06 7:18
Office Lineman30-May-06 7:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.