|
If i use unmanaged code in my application then how does runtime comes to know that this particular piece of code is unmanaged code.
praveen
-- modified at 9:24 Thursday 1st June, 2006
|
|
|
|
|
If you're using unmanaged (unsafe) code directly in your application, you need to mark it unsafe or it won't compile. The runtime will know because you marked it. Google "unsafe code tutorial" for more help.
If you're using an unmanaged assembly (e.g. -- COM), the wrapper will deal with the unmanaged code, but you need to make sure you clean up any resources in your disposal method. Any proper tutorial on how to correctly implement the Dispose method in your classes should tell you where to put the code for disposing of unmanaged resources.
Stephan
|
|
|
|
|
I m working on Custom Controls in windows . But i m facing one problem. Let i have made one custom control and added this one to one form in a project(Let it me Kapil1). Now i have made some changes in custom control.
Now in project Kapil1 i replace the old dll of custom controls with new one. But controls which i have placed earlier r not changed. They r working according to old dll.
Can u pls tell me how can i get my old controls working according to new dll.
Kapil
|
|
|
|
|
Firstly, posting in intelligible English may help us understand what your problem is.
Secondly this problem is well known and Google should have returned something useful to you.
Thirdly, try deleting the old dll in the bin and obj directories of the project you are using the control in.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
In the VB6, we could using SaveSetting/GetSetting to store the information and get them for personalization of windows applications. But all these need the programmer to write code to save & get & set the windows layout (such as the width/height of one control of form).
Is there any application block support personalization for .net 1.1 ?
I think the dynamic property could help but I found that not all properties are supported by vs.net 2003 IDE (I haven't tried vs.net 2005), so if I wish to make the property not support by vs.net 2003 IDE, I need to write code to store the setting (maybe the runtime width changed user before the winform closed), and restore the setting saved the next time UI shown again.
If I am doing such myself, then it should be something could be an application block, but is there existing application block for personalization for winforms in .net framework 1.1 ?
--
Do or do not, there is no try.
Do or do not, there is no try.
|
|
|
|
|
Kent Liu wrote: But all these need the programmer to write code to save & get & set the windows layout (such as the width/height of one control of form).
This seems to imply that you want all settings to be saved automatically, is that what you are looking for?
Note that all settings that require saving / loading will require coding, it just depends who does it, it could be the designer (as in VS .NET one), it could be you or it could be someone else who has hidden the code behind a nice GUI.
To be honest unless you have thousands of settings it'd be easier to save them yourself. Perhaps the easiest would be to use an ArrayList to store the settings while the form is running, when the form closes this can be serialized to a file (or even :shudder: the registry if you require), and then when it runs again, deserialize it back and reload the settings from it.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hi,
Is it possible to know the architecture/design of the component 'System.Web.Mail' present in .NET framework?
Ashu
|
|
|
|
|
Best starting point it'd suggest is Reflector[^] which will allow you to "see" the source code behind the class itself. I don't know of any documentation which provides a diagram of the component but it shouldn't be too difficult to use reflector.
On second thoughts I seem to remember an add-in for Reflector that would produce a relationship diagram between the classes used by the class under the cursor (in this case the Mail class), but I'm darned if I can remember exactly what it did and what it was called. Sorry
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hi guys.
i have a dll (C#), if i want to place this dll in one central mechine (server). and then want to utilize this dll on different multiple mechine in dotnet application. plz code & suggestion.
|
|
|
|
|
I think what you're trying to do is link a DLL on a remote machine. You can do this compile time or run time.
If you do it compile time, everyone has to have the same mapping to the server path where the DLL is. This is easier but more prone to breaking. All you have to do is map the server drive on the development machine as you'll want it mapped on all the clients. Then add a reference to your project (assuming you're using VS.NET), browse for the DLL, and find it on the server drive.
If you do it runtime, you have to find the DLL then load it into the app domain. You'll need to deal with configuring each user machine to find the server and the right path on it to your DLL. Once you know the path to it, execute:
<br />
using System.Reflection;<br />
<br />
...<br />
<br />
Assembly myAssembly = Assembly.LoadFile(myPath);<br />
After that, you'll need to use reflection to discover what you're looking for. GetTypes() on the assembly will give you a list of classes as Type objects. Each of those will report its public methods as MethodInfo objects.
Doing this runtime is much more complicated but all procedural. If you want a bulletproof application and you're willing to take the time to code it, do that. Otherwise save the hassle and compile-time link it.
Stephan
|
|
|
|
|
Wouldn't you be able to use the app.config file to specify where the particular version of this dll is located, you can then specify that it is on the server rather than the workstation. Surely this would be easier than using reflection. If indeed it works
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
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
|
|
|
|
|
Apply DataTable.Rows[0].AcceptChanges()
|
|
|
|
|
I am reposting this message in the .Net Framework discussion board.
The purpose of this email to hopefully gain some insight into implementing a javascript scripting engine within an application framework for a .Net application. I am trying to figure out how to provide scripting capabilities to an application. I would like to provide a scripting engine that enables customers to implement their own business rules. I would like to run custom javascript scripts that handle certain events (OnBeforeUpdate or OnBeforeDelete or OnBeforeAdd, OnAfterAdd, etc...) on different business objects.
I would like to stick with javascript because it's a widely used scripting language. I am just not sure how to go about implementing a javascripting engine into my .Net application framework.
I took a look at Visual Studio for Applications (VSA) which seemed like a possible option but the fact that it's being discontinued has lead to me seek out other options. Again, I would like to stick with a javascript solution.
Any ideas on how to get started with this?
Any thoughts or guidance on this topic would be greatly appreciated. TIA!
Regards,
-Derek
|
|
|
|
|
The first thing I would do if I were you is take a look at the Microsoft.JScript.JScriptCodeProvider[^]. You can use CodeDom to create a type and entry point, and then fill in the statements using a CodeSnippet* object. Then you just have to get familiar with AppDomains and such.
|
|
|
|
|
Hi
I am new to VB.NET. I want to call a batch file that registers Office XP Primary Interop Assemblies. I want to call this file when user clicks some button. On button event what code I need to write If the file name is "register.bat". I have tried it with Shell("register,bat"), it runs windows command prompt but it doesnt recognize the commands written in batch file. Can anyone help me.
Regards
Asif Hameed
|
|
|
|
|
Try this:-
System.Diagnostics.Process.Start("YourFile.bat")
Would you like to see my bits... (and bytes)
|
|
|
|
|
Thanx for your help but it also opens windows command prompt. But as i have told u earlier that i want Visual Studio Command Prompt as it can recognize gacutil command that can register dll files.
|
|
|
|
|
ah sorry, i misunderstood.
You don't need to have VS command prompt open to run GACUtil, you can do it in a normal command window provided you are in the correct directory or use the gacutil.exe's fully qualified location:-
i.e. C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin
I'm presuming you are trying to run this from within the batch file so make sure you either CD to the appropriate directory or include the gacutils location in the call.
There may be a slicker way around this but I bet this is simpler!
'================================='
Would you like to see my bits... (and bytes)?
'================================='
|
|
|
|
|
Hi friends,
i got probelm while adding fields to the dataset of report.i will explain bellow
i have a stored procedure. I added a dataset to the report and assigned the stored procedure to the dataset. then i want to another caleculated field to that dataset manually by the report.
i did that but for that field the expretion has a "SUM" function.
like sum(datasetfield1+datasetfield2). it is giving internall error
it is urgent.
it is urgent.
it is urgent.
(
Kiran Kumar
|
|
|
|
|
How toenter a field which is will take the a sum function
ex:
iff(Sum (fields!loan_amt_usd.value) <> 0,(Sum (fields!loan_amt_usd.value, {fields!gr4.value) * 100),0)
while inserting this it is giving internal error and it is closing the application.
Kiran Kumar
|
|
|
|
|
Friends,
Suppose there is an executable developed in C# using VS 2003, and is as such dependent on Version 1.1 of .NET framework.
Will this executable runs on a machine where only .NET framework 2.0 is installed ?
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote: Will this executable runs on a machine where only .NET framework 2.0 is installed ?
Yes There might be some small issues, but all in all it should run and work correctly.
|
|
|
|
|
I've an executable that was developed on .NET 1.1
Now i am running it on a machine where both .NET 1.1 and .NET 2.0 are installed. Now in this case which assemblies are loaded, 1.1 on which application is originally dependent or 1.2 ?
Imtiaz
|
|
|
|
|
If it was compiled for .NET 1.1 it will use .NET 1.1 if both runtimes is installed.
|
|
|
|