|
As with most things, this is actually stored in the registry. Take a look at the HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\Version\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories key. You may need to restart the environment (the IDE) after changing that, however.
To access this programmatically, if you look in the MSDN Online Library[^] you will find the VCPlatform object, which exposes those directories as properties. This is not in the EnvDTE.dll assembly, however. You must reference Microsoft.VisualStudio.VCProjectEngine.dll. IIRC, you should be able to cast (performs a QueryInterface on the COM component) from a Project object defined in the EnvDTE.dll assembly.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
For Tools->Options->Projects it's actually stored in the registry.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
If you've seen programs like "Ad Aware," or even many other programs, do you know how they make buttons that are not the typical boring box-type button. I have heard this is done using skins. But I'm not really sure how to do this, as I'm kind of a newbie to programming with c sharp. Any help or suggestions as to how I can create a more eye-pleasing button. Any help would be great. Thanks.
Stephen
|
|
|
|
|
For starting, check
http://www.nemhauser.com/presentation.aspx?id=nmi322
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
I've searched all my books and the Internet and cannot find a good example to read a text file into a hashtable. My text file is tab delimited as such below)and I need to load them into a hashtable as a DNS cashe...... Help.........
123.123.123.123 www.mywebsite.com
111.222.333.444 www.nowebsite.com
|
|
|
|
|
kvnsdr wrote:
I've searched all my books and the Internet and cannot find a good example to read a text file into a hashtable.
Books typically cover how to use particular mechanisms, you simply need to put the pieces together. This is a quick example method I wrote to read your file and insert the data into the Hashtable . Hope this helps.
private Hashtable GetHashtableFromFile(string file)
{
Hashtable ht = new Hashtable();
string line = string.Empty;
using(StreamReader reader = new StreamReader(file))
{
while((line = reader.ReadLine()) != null)
{
string[] args = line.Split(new char[]{' '});
ht.Add(args[0], args[1]);
Console.WriteLine("IP:{0}, Site:{1}", args[0], args[1]);
}
}
return ht;
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
I like the coding. I have an error in my code that says:
"Index was outside the bounds of the array"
All I changed was using(StreamReader reader = new StreamReader(MyFile.txt"));
????????????????
|
|
|
|
|
I think you have incorrect format of input file. Somewhere there are empty strings or parts of string are not delimited with tab symbol
modify the code like this
private Hashtable GetHashtableFromFile(string file)
{
Hashtable ht = new Hashtable();
string line = string.Empty;
using(StreamReader reader = new StreamReader(file))
{
int i = 0;
while((line = reader.ReadLine()) != null)
{
i++;
string[] args = line.Split(new char[]{' '});
if (args.Length != 2)
{
Console.WriteLine("Invalid input string: " + i.ToString());
continue;
}
ht.Add(args[0], args[1]);
Console.WriteLine("IP:{0}, Site:{1}", args[0], args[1]);
}
}
return ht;
}
Invalid string will be skiped and appropriate message displayed
|
|
|
|
|
Hi,
I have 2 questions regarding property grid:
1) I am using the property grid to show properties of class. For some of these properties I need to show drop down list .For static values i can use converter but how abt for those whose values I do not know until run time ?
2) How can I implement undo/redo in the property Grid.
Please help me out
Thank you
|
|
|
|
|
1. Write your own convertor and populate the SupportedValuesCollection.
2. Im not too sure, but maybe DesignerTransactions means something
top secret xacc-ide 0.0.1
|
|
|
|
|
Read Enhancing Design-Time Support[^] in the .NET Framework SDK. TypeConverter s (as leppie was vaguely referring to), UITypeEditor s, and more are at your disposal for implementing effective design-time support, such as drop downs, modal dialogs (like collection editors, for example), andmore.
The DesignerTransaction that leppie mentioned won't actually let you under and redo. It will - like transactions in SQL - let you rollback (in this case, not commit, though) changes or commit them depending on conditions that you implement (for example, the user didn't set a property so rollback all property changes).
There is no undo and redo provided in .NET, but there are many articles here on CodeProject that discuss different alternatives (and more on the Internet, though few regarding .NET). It's really not a simple problem at all and is very specific to an application (there's really no way to provide a universal undo/redo engine).
If you are designing a design-time component for use in other applications, then undo/redo functionality is already provided to you: VS.NET does it. You have to switch to code view, but you can undo changes there. Keep in mind that designers - for the most part - use the CodeDom to modify your source code (VS.NET does most of the work unless designers implement their own code serializer). They may, however, write to other files (like a ResX file) so this won't always work.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Hi,
I'm just wondering whether it is possible to force a class, which implements my Interface, to provide a specific ctor (say with an int parameter). If yes, how do write the interface then?
Is this possible or do I have to fall back on a baseclass model?
Thanks in advance.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
No, you can't force specific constructor, but you can force to have a method that returns an instance and create factory for it.
<br />
interface IFoo<br />
{<br />
... methods here...<br />
}<br />
<br />
interface IFooFactory<br />
{<br />
IFoo CreateIFoo(string a, int b);<br />
}<br />
<br />
public class MyFoo : IFoo<br />
{<br />
... methods from IFoo...<br />
public static IFooFactory factory = new MyFooFactory();<br />
<br />
}<br />
<br />
class MyFooFactory : IFooFactory<br />
{<br />
public IFoo CreateIFoo(string a, int b)<br />
{<br />
return new MyFoo(a, b);<br />
}<br />
}<br />
<br />
then to use it:<br />
IFoo foo = IFoo.factory.CreateIFoo("hello", 1);<br />
<br />
|
|
|
|
|
Thanks Werdna,
this is just what I needed.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
Interfaces cannot contain instance constructors. It seems to be a useful feature at first glance, but how would you implement separate interfaces which require a constructor with the same signature?
You could fake it by including an Init method declaration on your interface or use an abstract base class to force the matter.
Charlie
if(!curlies){ return; }
|
|
|
|
|
I am trying to read a file off a CD, I use this code:
FileStream oFileStream;
oFileStream = new FileStream( this.filename, FileMode.Open);
and the exception is that access is denied. My CD drive has no security settings, this is happening on all the files I try to read from CD. What could be wrong ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
You need to use a different version of the constructor.
Try this:
FileStream oFileStream;
oFileStream = new FileStream( this.filename, FileMode.Open, FileAccess.Read, FileShare.Read);
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
You are my hero, again. Thanks. Funny enough, the problem was in some code I found online ( to read ID3 tags ), and every other file read he did ( in different classes ) used this constructor.
As you may have guessed by the flurry of questions, my deadline is fast approaching. I'm cool with most of my project, but this parallel port access thing in particular has me worried enough that I'm starting to stress over everything...
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
From the .NET Framework SDK:The constructor is given read/write access to the file, and it is opened sharing Read access (that is, requests to open the file for writing by this or another process will fail until the FileStream object has been closed, but read attempts will succeed). The buffer size is set to the default size of 4096 bytes (4 KB). Since you can't simply write to a CD, the request to open the file with FileAccess.ReadWrite would fail. You must, therefore, use another constructor so that you can specify FileAccess.Read only.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Hey Everyone -
How can I go about monitoring the TCP packets going to and from my computer?
I have a client that connects to a server and can send data to the server, and I'm looking to use a second client to read the data being sent from the server to the first client (which the first client doesn't see). Is there a way for the second client to tap into the first's streams?
Thanks.
|
|
|
|
|
Checkiar this out http://www.mentalis.org/soft/projects/pmon/
/\ |_ E X E GG
|
|
|
|
|
|
Hi all,
I am trying to develop a stand-alone windows application using C# .NET that uses the Amazon.com web services. I added the WSDL to my project as a web reference, but now I'm having a little trouble figuring out how to send a search request. in the API, there is an ItemSearch object, and ItemSearchRequest object, and an ItemSearchResponse object - could anyone show me how to use these to search by a keyword, passed to my function as a parameter? I know how to do it using AWS 3.0, but I cant figure it out in 4.0. Any help would be much appreciated.
Thanks,
Justin
|
|
|
|
|
|
I'm working on an application that will use a custom input device, supplied by the client, which connects to the parallel port. They've given me a disagram which looks like this
25 Status 0 1 2 3
11 S7 ML H Men LF
15 S3 LB A/T PB A>>Z
13 S4 Z<
|
|
|
|