|
Check Directory Browsing permission. You must set directory browsing permission to true. This will allow to get it a list of files/folders.
|
|
|
|
|
Hi ,
What is the advantage of using IList over List in C# ? what is the difference between List and Ilist ?
Thanks,
Azeez
|
|
|
|
|
List implements IList. It takes the features of IList and implements them. Also, you can only actually create a List - IList is just a contract, or an Interface. So, List is better.
|
|
|
|
|
If you take a normal List<T> and call it's AsReadOnly method then it returns an IList<T> , so I assume an IList can be readonly whereas a List can't. I've never looked into it so I could be wrong... just an observation I made a couple of months ago and figured I'd investigate one day!
|
|
|
|
|
IList is an interface from which all lists derive from. So, while List is an IList, the opposite is not true.
If you need a normal list, use the List class, if you need to build your own list with custom behavior (such as read only, for example), derive from IList.
If you want your method to accept as parameter different type of list from the standard one, use IList as parameter type.
If you want to hide the specific list type your method is returning, use IList as return type.
|
|
|
|
|
Flexibility.
A method that accepts a List can only accept a List (or something derived from List), whereas a method that accepts an IList can accept anything that implements IList, not just List.
|
|
|
|
|
Hi,
I want to change icon of any type of setup (exe) file through code.
Thanks.
|
|
|
|
|
I doubt you can. The icon is embedded in the build. You would certainly need to change the icon of ANOTHER program, not the one with the code in it. Or do you mean the icon that's shown on the taskbar ? That is a property you can set in code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How can I embed the icon at the time of building, through the code.
|
|
|
|
|
Why do you want to use code, instead of the project settings, like everyone else ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Why do you want to use code, instead of the project settings, like everyone else ?
I think he means the latter, English isn't everybody's first language
Of course, there's the possibility he's a cretin, but I'm willing to give him the benefit of the doubt.
Cheers,
Vikram. (Cracked not one CCC, but two!)
|
|
|
|
|
Well, I answered in such a way as to make the answer clear, but also to ask him, if he meant what he said, why he is intent on using code to do it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i am making the application in which i need code to create his own desirable icon of the particular exe file and to create logo of exe through our application rather than Visual Studio.
Thanks
|
|
|
|
|
Hello Friends,
I have inherited the DataGridViewColumn class and add new property in it.
I am able to see myClass and its property in DataGridView but when I set the value to my property, it is set to null automatically. Here is my class :
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace dataridviewColumns
{
public class DataGridViewFinderColumn : DataGridViewColumn
{
public DataGridViewFinderColumn()
{
this.CellTemplate = new DataGridViewTextBoxCell();
this.ReadOnly = true;
}
private string _Caption;
public string Caption
{
get { return _Caption; }
set
{
_Caption = value;
}
}
}
}
Thanks and Regards,
Rahul
rahul saini
|
|
|
|
|
I have no idea why your property returns null, but if Caption is intended to do what I assume it is for, why not use the HeaderText property that your DataGridViewFinderColumn should have inherited?
This sets the text in the header cell, which is what I assume Caption is intended to do.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Henry,
Actually this caption is not for the column header this value is passed to my user control that i need to add in to datagridview column. But when i set value to these properties it sets these property back to null.
Let me explain me the whole requirement :
I have made a user control which need some value to run like query, connection string etc for which i have made properties in that control.
Now I want to create new datagridview column of my user control type and need to forward values to my control for which i have use properties.
Whole thing is that i need to add my user control in datagrodview column and set its property. so that i can use it in grid.
Thanks and regards
Rahul
rahul saini
|
|
|
|
|
I'm sorry to have taken so long to reply, but I have been struggling to find a reason for your problem.
Unfortunately, I have not found one. I have written custom DGV columns, before, with extra properties and all of them worked a treat. No matter what I do with your code, I cannot get it to work.
I will keep trying, though, because it is now officially driving me nuts.
If I find anything I'll get back to you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry,
I am also trying if got any any solution will update you.
Thanks & Regards,
Rahul
rahul saini
|
|
|
|
|
Progress, of sorts.
If, instead of using the 'Edit Columns' option from the Smart Tag on your DataGridView, you use the drop down at the top of the properties window to select your column, and edit in the properties window, it seems to take. It does on my system anyway.
Give it a try.
It's not ideal, but until one of us finds the real solution, it should help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
what is the use of parameter passed in lock block and why it must be always reference type?
Thanks.
|
|
|
|
|
It's just something to hold onto. Only one thread can hold it at a time, all the others have to wait for it to be passed.
|
|
|
|
|
Thanks. But you know it is not expected that the parameter should be used inside code, the protected variable can be something else then parameter. So there is no sense in passing parameter like we normally use in methods.
|
|
|
|
|
What I think you are saying is that it makes no sense to use "lock(parameter)" when we could just use "lock". If so, then you are wrong - "lock(parameter)" allows multiple, different locks: "lock(myBuffersSection)" and "lock(myXMLOutputSection)". In this way, only the threads that need to be frozen until a specific lock is available are frozen - all the others can continue.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
OK, so can you tell me that when we are sending parameter to the lock block is it treated as an input parameter similar to method? Like we send parameter to the method and method will use it.
|
|
|
|
|
This is going to be a bit complicated, and I strongly recommend you find a book and read up on multithreading, because it is quite important that you understand what (and why) it happens.
The lock keyword requires you to specify a token (an object reference) that must be acquired by a thread to enter within the lock scope. When you are attempting to lock down a private instance-level method, you can simply pass in a reference to the current type:
private void SomePrivateMethod()
{
lock(this)
{
}
}
However, if you are locking down a region of code within a public member, it is safer (and better practice) to declare a private object member variable to serve as the lock token:
public class MyClass
{
private object threadLock = new object();
public void MyMethod()
{
lock (threadLock)
{
...
}
}
}
Why does it have to be an object? Why can't it be an integer? Or a bool?
This is more complex, and it goes back to the beginnings of what you probably learnt when you were starting. Do you remember all that suff about Value types and Reference types? Well, the lock token must be a reference type, because otherwise when you pass it to the lock block, it would get re-packaged into a reference type container, which would then be locked. If a second thread came along and passed it to a lock block again, it gets re-packaged again, and a different reference type container gets locked.
Remember that (like so many things in C#) "lock(token)" is a "short cut" for a method call - in this case Monitor.Enter and Monitor.Exit - so you are actually passing the token to a method. The parameter works teh same as it would for any other method, packaging and all.
Does this make sense? It is a bit complicated!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|