|
Colin's question still stands. Did you close the file before you set the object you used to null . If not, and even if you dropped your reference to the stream object, the underlying unmanaged file handle is not released until you either call the Close() method or the Garbage Collector gets around to calling the objects .Dispose() method. Until one of those two things happens, the underlying file handle will remain OPEN and, hence, sitll in use by another application, specifically, yours.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, I have never really done to much with the timer, and after reading the intro on MSDN, I need to ask this question. I have 5 different items that need to be run. If I create 5 different timers, will each of these run in its own process when the timer fires? Or will they all run in the forms process?
|
|
|
|
|
That depends on what type of timer you are using. I belive that Windows forms timers are run on the main UI thread. System timers run on their own threads. If you go the system timer route be sure not to modified form controls on those threads.
Forever Developing
|
|
|
|
|
I write an application by C#, how i can embedded dll to my project that i can use it like a library for my app. When i complier my application the *.dll will combine in my *.exe, and i don't need it any more.
Thank advance
|
|
|
|
|
I think you are asking about static linking in C#. There is no static linking in .NET. If you have acccess to the DLL why not just include the class files from the DLL project in the exe project?
Forever Developing
|
|
|
|
|
Because my dll is owner by another, i want to embedded to run everywhere not to install
Nothing
|
|
|
|
|
This can't be done in .NET
Forever Developing
|
|
|
|
|
|
hi experts ,, i wana know that how to add a existing class in a windows application project in C#.and how to use it by making objects or watever.. i hope u will understand. waiting for yours reply. plz make a simple application with a button that i can understand easily(make any class declaration and add it)
ishi_us@yahoo.com
|
|
|
|
|
How can i import images stored in a database into a listview control
in thumb nail format.(must support all types of images).
I must be able to view all the images at a time.
Gopi K
|
|
|
|
|
|
Does anybody know any .net image processing library implementing famous filters like "Haar Wavelet"? If not, do you know any powerful Math library which helps to implement such filters?
Regards
|
|
|
|
|
How to find out details of the functionality exported by a legacy dll (which may not be a COM etc., which means it cannot be referenced from .NET project)? Is there any utility which can give details of the functions and data types etc. of such a legacy DLL?
|
|
|
|
|
I use ildasm.exe find it in your SDK directory under bin.
It will give you the attributes and methods/classes exposed by DLL!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
ILDASM.EXE does not work on a legacy dll and it gives the error "... does not contain CLR header and therefore it cannot be disassembled."
Any solution please?
|
|
|
|
|
sorry to hear that! but I always used ildasm and never found any problem!
The least I can tell you is this:
go to a C# reflection tutorial and write a program to get the attributes/methods/classes at run time!
it's pretty easy, and you should get all the info you need.
Far from that I don't no!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
DependencyWalker[^] can show you the functions exported by a DLL.
Usually you won't be able to determine the number and type of parameters a function expects, because legacy DLLs didn't expose such meta information.
mav
|
|
|
|
|
Hello,
I have 2 forms. One is called librarySettings, and another one is called loanBook. When the user wants to loan a book, l want to be able to receive 2 variables from this form, which is DaysBorrowed, and OverdueFine. This way if the settings are changed then the loanbook form will have the updated variables.
This is what l have done, and l have done this before, but can't seen to get it to work. Don't know what is going on here.
LibrarySettings form.
[code]
This load the variables data from a database, so that the settings can be updated to a database.
private void frmLibrarySettings_Load(object sender, System.EventArgs e)
{
try
{
cnn.Open();
OleDbCommand cmd = cnn.CreateCommand();
OleDbDataAdapter da = new OleDbDataAdapter();
DataTable dt = new DataTable();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM LibrarySettings";
da.SelectCommand = cmd;
da.Fill(dt);
upDDays.Value = Convert.ToInt16(dt.Rows[0]["Days"]); //load into a numericUpDown control
upDFine.Value = Convert.ToInt16(dt.Rows[0]["Fine"]);
}
catch ( OleDbException ex )
{
MessageBox.Show(ex.Message);
}
catch ( Exception ex )
{
MessageBox.Show(ex.Message);
}
}
[/code]
//Set up 2 public procedures
[code]
public int fineAmount
{
get
{
return Convert.ToInt16(upDFine.Value);
}
}
public int DaysToBorrow
{
get
{
return Convert.ToInt16(upDDays.Value);
}
}
[/code]
That is all for the library settings form
for the loanbook form.
I have declared this in the form at the top of the class
<br />
frmLibrarySettings getLibraryDetails = null;
Find out how long the book can be loaned for.
<br />
int loanDays = 0;<br />
loanDays = getLibraryDetails.DaysToBorrow;
The error message l get when this code is executed is " Object reference not set to an instance of an object."
Not sure what l am doing wrong. Hope someone can help
Thanks in advance,
Steve
|
|
|
|
|
frmLibrarySettings getLibraryDetails = null;
and then:
loanDays = getLibraryDetails.DaysToBorrow; //getLibraryDetails still null?
??
u can't get a property value from an object that hasn't been initialized
|
|
|
|
|
Thanks for the reply,
I am coming from VB so not sure if what l am doing is correct. Do l have to initial the object in the constructor?
Any sample code would help.
Thanks for your help,
Steve
|
|
|
|
|
Make a global variabel i.e. private frmLibrarySettings getLibraryDetails;
in the constructor initialize it: frmLibrarySettings getLibraryDetails = new frmLibrarySettings(/*parameters?*/);
now u can call functions and properties on getLibraryDetails from anywhere inside the class
|
|
|
|
|
alternatively u can initialize it in the XXX_load function
|
|
|
|
|
Thanks for your help,
frmLibrarySettings getLibraryDetails = new frmLibrarySettings();
Was the answer
|
|
|
|
|
Well if I am doing that for me...I would use a simple Object Oriented approach.
1. make a local variable in your second form for the information you need to gather.
2. write 2 simple methods to get and set that information.
3. when calling the second form after all processing just write
<variable> = <form_variable>.getXXX();
for example say I have a form to get a point from the user and it have this in the second form:
...form declarations
int x;
int y;
.....
....
public void setX(int x)
{
this.x = x;
}
public int getX()
{
return x;
}
....from the other (first) form just do:
int x;
x = form2.getX();
int y;
y = form2.getY();
by the way...the set x is there so that you can manipulate it later on!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
Hi
I have made a service in C# from where I would like to send keystrokes to the application in focus.
I have tried to use the SendKeys class calling the function
SendKeys.SendWait
When I do that I get an exception "unable to create hook"
Can anybody give me a hint how to solve that ?
Thanks
Brian
|
|
|
|