|
First, you can't do that. The main reason is you don't control the file handle. Second, you can't clean up the resources in the app that has the file open in the first place. You'll only cause whatever app that is to crash because its file handle disappeared unexpectedly.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Firstly, chances are you won't be able to do this solely from the .NET framework. You'll probably have to dip into the Win32 API to find out which processes have loaded a particular file handle. That's where you'll want to start, see how you can get that information from the Win32 API.
Like Dave said, you couldn't really "unlock" the file. You could terminate the process that owns the file handle, if you can find out which process owns a particular file. And I don't know whether or not that's possible...I would guess it is, but I'm not knowledgeable enough to say.
|
|
|
|
|
Can anyone tell me how to write a Base64 Encoded xml file? I ve written the following 2 statements:
XmlTextWriter writer;
writer = new XmlTextWriter("msg.xml",null);
The second argument of XmlTextWriter is presently null, and it accepts the Encoding! Can anyone tell me what do I need to write in place of "null" to write the file as Base64 encoded?
|
|
|
|
|
I'm building a window base application, I'm supposed to use:
public class MemDoc : System.Collection.Generic.List<Member>
It's methods are simple add record, save file, open file.
I have a seperate Member class with all it's assignments and properties including an instance of another class.
Could someone point me to a good resource on how to access this when I'm not using :
static List<Member> MemberArray = new List<Member>
Trish Holt
|
|
|
|
|
Hi Trish.
Your question doesn't sound right, logically. So perhaps we can clear this up:
You're trying to make a class called MemDoc and have it inherit from a generic List of Member objects. Is this correct?
You're trying to access a static variable called MemberArray inside this MemDoc class. Is this correct?
|
|
|
|
|
GreenApple30 wrote: static List<member> MemberArray = new List<member>
Do you mean you wanted to use MemDoc instead of the above code? If that's the case then you just simply need to create an instance of MemDoc:
MemDoc MemberArray=new MemDoc();
...
foreach (Member memberItem in MemberArray) {
...
}
|
|
|
|
|
Hi,
I have a field of type datetime in my SQL database and I want to populate that field from parsed date from email message. My email message parser is giving me this following string as date.
"Thu, 13 Apr 2006 11:37:18 -0700 (PDT)", now , is there any common way to convert this string into C# DateTime Format so that I can insert this value in my SQL datetime field.
Please help...
Thanks
|
|
|
|
|
|
Thanks a loooooooooooot for the information.
|
|
|
|
|
|
I am adding items to a listView, but during runtime I see them being displayed one next to the other, instead of one below the other. I mean that I see that item 2 gets added to the listView and is displayed parallel to item 1 present in the listView instead of being displayed below item 1. Can anyone tell me the reason and possible solution to display it one below the other?
|
|
|
|
|
|
Hi,
I want to write a program that controls IIS. The reason that I don't want to use MMC(tool of Microsoft used to configure IIS) is that I want to group some operations to do a specific thing into 1 operation.
Can you give me some suggest?
thanks for your help,
Hung
|
|
|
|
|
Hi to all
In windows application (C# or Vb.net) How we can add (one time) some PictureBox or ImageList into project and reuse its in all Forms.
in normal we must for each form add its ImageList and PictureBoxe.
it is very important to reduce exectable file size.
Please Help me: zolfaghari@usa.com
zolfaghari <zolfaghari@usa.com>
|
|
|
|
|
put it in a usercontrol and load that control whenver (wherever) you want it
regrads,
g00fy
|
|
|
|
|
can anyone tell me some way to set different colors for different Items that I add to my listview? I am inserting strings into a listview, but I want them to appear in different colors, how can I do that?
|
|
|
|
|
You can set the foreground and background colors of items in a list view, as in:
ListViewItem lvi = myListView.Items.Add ("Hello");
lvi.ForeColor = Color.Red;
lvi.BackColor = Color.Beige;
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
In reply to your email:
Do you know how do I do this:
I am adding items to a listView, but during runtime I see them being
displayed one next to the other, instead of one below the other.
I mean that I see that item 2 gets added to the listView and is
displayed parallel to item 1 present in the listView instead of being
displayed below item 1. Can you tell me the reason and possible
solution to display it one below the other?
Best Regards
Rahul Taing Set the list view's View property to Details .
/ravi
PS: Am posting your email here so others may benefit from your question. Replying to a post (vs. sending email) is the preferred way of communicating at CP as it allows others to share (and provide) information.
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi,
Is there a way to find out Internet Explorer (or Firefox) settings through C#? I am writing a WinForm Application and need to collect information about the user's browser settings, including the list of plug-ins installed for the browser.
Does anyone have any ideas how I can get this information? I really appreciate your help!
Thank you,
Farhat
|
|
|
|
|
Hi,
Check this link http://www.dotnetbips.com/articles/displayarticle.aspx?id=172
I think this may be useful for u...
Thank you,
Vaibhav
|
|
|
|
|
Thanks Vaibhav,
That article seems to talk about getting the browser capabilities from ASP.NET. What I want to do is to create a windows application that can run in the background and monitor the internet settings of the browser, especially what plug-ins have been installed. If a change is made to them, the application can record it in the internal database. I have looked around and can't seem to find a way to do this. Is there a way to accomplish it? Is there a way to enumerate the plug-ins available on the computer?
Thanks,
Farhat
|
|
|
|
|
How to open a html page by IE when click a linkbutton or a button in Compact Framework?
Thanks
Nothing
|
|
|
|
|
Hi, I am using the P/Invoke to call some methods from an API "wrg303API.dll". I am currently facing problems to convert few of the methods and variables to .NET (c#)..
1. [C/C++ declaration] char szSerNum[9];
[C# declaration]
[MarshalAs(UnmanagedType.ByValArray,SizeCount=9)]
public char [ ] szSerNum;
2. [C/C++ declaration]
DWORD dwVcoFreq[8];
[C# declaration]
[MarshalAs(UnmanagedType.ByValArray,SizeCount=8)]
public DWORD [] dwVcoFreq;
Can I write "string" instead of "char [ ]" and then put the limit on its size. Any suggestion for the "DWORD" array
Now the methods which have problem:
3. [C/C++ declaration]
BOOL __stdcall G3BlockScan (int hRadio,DWORD *Freqs, int Count,int StopSquelchRaw,DWORD feedbackTime,
HWND WinHandle,DWORD Msg);
[C# declaration]
[DllImport("wrg303api.dll")]
public static extern bool G3BlockScan(int hRadio,ref uint Freqs, int Count,int StopSquelchRaw, uint FeedbackTime,
IntPtr WinHandle,uint Msg); I am using IntPtr for HWND .. is it right? Or there is an other option.
4. [C/C++ declaration]
BOOL __stdcall CodecStart(int hRadio,void __stdcall (*CallbackFunc)(void *),void *CallbackTarget);
[C# declaration]
5. [C/C++ declaration]
DWORD __stdcall CodecRead(int hRadio, void *Buf, DWORD Size);
[C# declaration]
I need the equivalent of methods 4 and 5 in C#
6. [C/C++ declaration]
BOOL __stdcall G3GetPath(int hRadio, char *Pathname, size_t size);
[C# declaration]
[DllImport("wrg303api.dll")]
public static extern bool G3GetPath(int hRadio, string Pathname, size_t size);
What will be the equivalent of “size_t” in c#
I would appreciate if any1 can help me...
|
|
|
|
|
Hi everybody
Where i can put my code if i whant he to be execude befour postback or how to make some event who start befour post back???
Pleas help me
than you
//using version visual studio 2005
-- modified at 16:54 Friday 14th April, 2006
|
|
|
|
|
Are you talking about postbacks in a web application? If so, then the ASP.NET forum would be right place to ask.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|