|
I want to dispose my previous form on the after select event of tree view control but when i try to do so i get the following exception message
System.ObjectDisposedException: Cannot access a disposed object named "TreeView".
Object name: "TreeView".
This problem has definate solution but It is bit complicated and I m not able to understand it plz any one can help me out in simple words or even some one only tell me that how can i close one form another form ....I tried it to close it even by making its object on that form n then call its close function ...But it too doesnt work ...i m building Windows application In C# 2003.Thanx for Ur help
|
|
|
|
|
Implement IDisposable Interface in all the pages and use the dispose method !!!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Can u plz provide me some examplary piece of code
Thanx
|
|
|
|
|
hi i have a webservice in vs2005, and i am trying to access that from my vs2003 application.
To service methods are defined onr is "helloworld",default method.Its working properly
But in my next method i am trying to return a datatable.
But it showing some error on running
the exception is aditional information: Method Service.GetAction can not be reflected.
GetAction is my method.
this is the reference class
/// <remarks>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetAction", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public DataTable GetAction() {
object[] results = this.Invoke("GetAction", new object[0]);
return ((DataTable)(results[0]));
}
/// <remarks>
public System.IAsyncResult BeginGetAction(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetAction", new object[0], callback, asyncState);
}
/// <remarks>
public DataTable EndGetAction(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((DataTable)(results[0]));
}
I changed the datatype to datatable.
My small attempt...
|
|
|
|
|
First and foremost you can't return datatable from web method rather return dataset containing databale !!!!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Ya i tried to return one dataset from service it was a success.
But in the webmethod i am trying to get a dataset by executing the query, by creating the instance of another class.But it gives an exception.......
[WebMethod]
public DataSet GetAction()
{
DataSet dt = new DataSet();
DataLayer.WebSrevice webser = new WebSrevice();
dt = webser.GetActiontable();
return dt;
}
it will work if i remove
DataLayer.WebSrevice webser = new WebSrevice();
dt = webser.GetActiontable();
this lines, ie i cant access the other project from the service class
My small attempt...
|
|
|
|
|
Am not to sure of the problem statement ... Could you explain every thing ?
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Hi
I have few doubts, as I am going to release my app:
1. My application developed in C# VS2005 needs .Net Framework to be installed in PC.So, if the user runs the app, is there any way to detect for framework , prompt and start downloading .Net Framework from Microsoft?
As it is very frustrating for user to go to website , search and download.
2.I need to change the host file in PC , ex:192.168.51.150 something.com.
Can it be done programmatically??
Immediate reply is appreciated.Thanks in advance
Aruna
|
|
|
|
|
1 - If a PC does not have .NET, I believe it will just crash, you need to provide an installer that also installs it.
2 - If you have permission, you can write to any file on the PC. Which means, if it's Vista, you won't have permission
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In Visual Studio, right-click your solution and select Add New Project. For the project type, find the Setup Project (it should be under Other Project Types-> Setup and Deployment)
One of the things you can do in such a project is specify prerequisites. One such prerequisite will be the .NET framework. You can tell it to download the prerequisite from the vendor's website - in this case, it will automatically know where to download the .NET framework from.
If this isn't enough detail, there are several very good articles on this website describing how to do this in extreme detail.
*****
For the hosts file, you may want to consider not making that edit. While (on XP) nothing stops you from doing so, it is considered by some antivirus and anti-malware programs to be virus or malware-like behavior and it will be immediately stripped out.
Unless you can guarantee that the end user's system won't do that, you shouldn't rely on it.
Unless there's some convincing reason you actually MUST use a hostname, it might just work better for you to use the IP address.
But yes, this can be done programatically. The hosts file is just a file on the computer like any other and edits to it take effect immediately. It is located at %SYSTEM%\drivers\etc\hosts, and the best thing to do is probably just append a line at the end so as not to alter any existing custom hosts (for example, I put some in there sometimes when websites I'm working on haven't resolved through DNS yet).
|
|
|
|
|
Thanks for your detailed reply.Its working fine.
But I have one more doubt regarding memory usage.When I run the application the memory is 170 000K, when I minimise the app, it drops drastically.
Is it ok?I heard the task manager does not show accurate memory usage.
Do I need to take any action?
Or in the start of the program, do I programmatically minimise the form and maximise again?
Please clarify my doubts.
Thanks
|
|
|
|
|
Krypton 2.5.1 Released
For those not familiar with Krypton, it contains the FREE (as in beer)
Krypton Toolkit that allows Windows.Forms developers to create Office 2007 style applications both quickly and easily. You can use a single line of code to alter the global palette and so the entire look and feel of your application.
It includes the following...
Extensive samples in C#
Full integrated documentation
Visual Studio templates for quick start
Support via forums
Visiblity of changes via blog
Download it using the following link...
http://www.componentfactory.com/downloads/KryptonToolkit251.msi
Regards
Component Factory
|
|
|
|
|
The way I see it, you have two options
1 - post an article on this site ( that would rock )
2 - pay for advertising ( really, you'd only choose this if your code was not 100% and unencumbered ).
Either way, thanks for supporting the site, and not spamming it again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I would love to write some articles that show how to use the free Krypton Toolkit. I didn't think that was allowed; because although I can provide the install for the Toolkit, and the Toolkit is free even for commerical use, I cannot provide the actual source code. Would it be ok to provide just the build?
|
|
|
|
|
OK, I'm not sure about that, I'd suggest writing to Chris and asking him.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
well just want to say hiya to start with.
i need a bit of healp on C# GUI programming.
the problem i have is this.
i need to vreate a C# forms appliction that access data from the registry.say the CPU speed for example.
then it need to display it on the forums.how do i do this.
thanks guys!
Ashley
|
|
|
|
|
If you're wanting the CPU speed, you should be looking at WMI since the CPU speed is not kept in the registry. Look in your help files for "Registry Class". The examples there are quite good for basic information. If you have questions beyound that information, by all means please ask.
Phil
|
|
|
|
|
hi phil thanks for replying.
all i need to do is access the reg or WMI and display the info on a GUI win app project.
i dont suppose you have any example code at all do you.
thanks!
|
|
|
|
|
There are many examples of that on this web site. Do a search for "Registry" or WMI and you will get a number of hits. Be sure to limit your search to C# and you will get mostly C# articles. You should download the examples and go through them.
Phil
|
|
|
|
|
do you have a link to just one of them.
the only ones i can find are console and does not help me at all.
i cant seem to find anything on forms programming.
thanks!
x
|
|
|
|
|
Ok, now I understand the problem you are having. I believe it is this:
You have a control on your form such as a text box in which you want to place a value. The value might be the current CPU usage or other value. But you can't seem to display it on the form.
Try doing the following:
Add a button to your form
Add a textbox to your form
Double click on the button which will generate the _Click(...) stub. In this stub do the following:
Pseudo code
int myValue = 110; // Replace this line with a query to WMI or the Registry
TextBox.Text = myValue.ToString();
End Pseudo code
The second line in the pseudo code block I believe is the information you seem to be missing.
Phil
|
|
|
|
|
hi,
I originally wrote an object as a struct, and now I am changing it to a class.
In one of my member methods I want to pass "this" by reference to a method in another class and I get teh below error when I try to build? Is this common? Anyone know why it works with a struct and not a class?
Cannot pass '<this>' as a ref or out argument because it is read-only
thanks
cb
|
|
|
|
|
Hi,
for structs, ints and other simple data types, "this" is the value itself
(hence the name "value types"); you may add the "ref" keyword to obtain a
reference to it (similar to a pointer in C/C++).
for class instances, "this" is a reference (hence "reference types"),
so it behaves as a pointer would in C/C++; hence you should drop the "ref"
all together when switching from struct to class.
|
|
|
|
|
Hi,
as Luc already suggested, you can just drop the 'ref' from your method's parameter and everything should work. I will just add some explanation why you must not pass 'this' as a ref parameter.
If you have a value object (a struct) and you pass it by value (no 'ref' parameter) to the method, the method gets its own copy and the original will not be affected by any changes made in the method. If the value object is passed by reference, all changes do affect the original.
If you have a reference object (a class) and you pass it by value, the reference itself is copied. Thus you have two references to the same object. If the method changes the referenced object, the changes will affect the original. However, if the method changes the reference itself (e.g. set it to 'null'), this will not affect the original reference. If you pass the reference object as a reference parameter, you are able not only to manipulate the referenced object but also the reference itself. Sometimes this is the desired behaviour, but you definitely don't want enable any method to set your 'this' reference to 'null'. Therefore 'this' is read-only and must not be passed by reference.
Hope this helps.
Regards,
Tim
|
|
|
|
|
Hi,
I need help in reading an edit box from one application (java) to a C# application.
Currently (using Spy++ / Winspector as reference) I have been able to locate the parent handle of the java application using FindWindow like so:
IntPtr hWndParent = FindWindow(null, "Application Name");
I then find the correct child handle by looping through all the child handles until I get to the actual edit box on the java application using FindWindowEx like so:
IntPtr hWndChild = FindWindowEx(hWndParent, IntPtr.Zero, null, null);
Now that I have the address of the edit box, I am wanting to pull the actual data stored in the edit box and save it into the C# application.
jn
|
|
|
|