|
I can get my local IPv6 address in Win2003 use the source code as below:
string localName = Dns.GetHostName();
string address = "";
string scopeId = "";
IPHostEntry hostEntry = Dns.Resolve( localName );
foreach (IPAddress curAdd in hostEntry.AddressList)
{
if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
{
scopeId = curAdd.ScopeId.ToString();
address = curAdd.ToString();
break;
}
}
Then, I set the config about IPv6 in WinXP as the same as Win2003. when I run the source code in WinXP, I can only get the loopback(::1) address but not local IPv6 address.
Thank you for your help!
|
|
|
|
|
|
thank you .
Here is my sequence to setup IPv6 in WinXP:
1、Open the propertiy of local connection, add the McroSoft IPv6 protocol
2、Start a command prompt window and type "ipv6 install"(Window XP).Then I check this by typing "ipconfig/all" at the command prompt, IPv6 address OK
3、Open the machine.config file that is located in the .NET Framework CONFIG directory (on Windows XP it is located at
C:\Windows\Microsoft.NET\Framework\v1.1.XXXX\CONFIG) . Change the XML tag:
to:
<ipv6 enabled="true">
This allows the framework to parse and resolve IPv6 addresses.
DNS need setup in my PC?
|
|
|
|
|
In my C# winforms datagrid, how do I get the value of the selected cell?
|
|
|
|
|
hi,
I wrote an article which contain solution for this queary. Please refer that first. If it is not serving your purpose then please let me know.
http://www.codeproject.com/csharp/Apply_DataGridTableStyle.asp
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
in this code I know the current item index is "y" Code1:
<br />
for (int y = 0; y < 1000; y++) {<br />
}<br />
How I do to know the current item index? Or I need use the Code3? Code2:
<br />
string[] strArray = new string[........]<br />
foreach (string y in strArray ) {<br />
}<br />
Code3:
<br />
string[] strArray = new string[........]<br />
int x = 0;<br />
foreach (string y in strArray ) {<br />
x++;<br />
}<br />
If I need of Code3 to obtain the current index, then is better use the Code1...
Sugestions?
Thanks in advance!
|
|
|
|
|
AFAIK Code 1 is better, because no slow enumeration methods are called.
If you know the count of items in a list (and you always know Array.Length), use an index.
|
|
|
|
|
I want to get all file name in main directory of remote server,but I don't know how to design the code. Can you help me? Thank you!
|
|
|
|
|
There's a vast amount of different ways you can follow, mainly depending on the remote server and your access rights there.
You could use UNC paths, if the directory is accessable this way (Directory.GetFiles(@"\\MyServer\MyShare", "*") ).
You can use a server program running on the remote server, listening for requests on a port and then returning the directory contents.
You can make life easier by using .NET remoting to access this server program.
(...and many other ways...)
Pick one.
Regards,
mav
|
|
|
|
|
Thanks for your help! But I'm a beginner,and I know little about programing.Can you tell me more about it? Thank you!;);)
|
|
|
|
|
I need to use Ms chart to plot a graph in c#. however i dunno how to use. Anyone willing to help me?
|
|
|
|
|
hi,
I posted same question in codeproject. I searched lot of Microsoft shelf's and coludn't able to find any documentation.
Upto my level best Microsoft Corp didn't released any documentation which deals how to use MSchart control in .NET Application.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
In the IDE, you can reformat a file, or selection thereof, using Edit|Advanced|Format Document (or Format Selection.) This is great except I want to prevent it from reformatting one section of a file where I have everything organized neatly by columns.
Is there a directive of some sort to prevent the IDE from reformatting certain sections of a file?
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
No, not in Visual Studio. If you don't want to format a certain selection, though, don't select it and use "Format Selection".
You might consider googling for Visual Studio add-ins. There is one that advertises here on CodeProject (the name escapes me, and it's not the current banner) that may do what you need. Whether you can prevent sections from being formatted to me is unknown.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Visual Studio 2005 won't reformat the layout of your code.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I'm actually using both VS 2003 and 2005. 2005 won't auto-reformat but it will reformat the code section if you go to Edit|Advanced|Format...
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I was referring to it not auto-reformatting the code, a nice change.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I run across ideas that don't really require a lot of code and are usually just to test out small pieces of code. In fact, it's now getting to the point where I have almost 100 folders with different little mini-projects. How do you manage your smaller projects in VS.NET?
I don't even know what half of those old projects were for now, so I have to go back through and open them to find out what I was playing with. I'm trying to figure out a better way to organize them and to get them built quicker then open a new project for every little idea or play code project that I run across.
|
|
|
|
|
I keep a separate folder for each real project I do, and then a folder called 'My Code', where everything else goes. I name the projects clearly enough that if I don't know what it does, I probably don't need it, so I delete it. If I ever need it again, it's on a backup CD.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
In Visual Studio 2005 you can now create a project, modify it all you want, compile, and test all without saving. Forget having hundreds of scratch folders lying around! This is definitely a feature I'm looking forward to.
My suggestion: quite using Visual Studio for test code snippets. Almost everything I write for CodeProject - both for articles and for the forums - I use the command line compiler (csc.exe) and a text editor called ViM[^]. Makes it really easy to not have lots of project files and intermediate files lying around.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
How do you organize the code snippets once you have them working the way you want them to? I guess I'm lazy, and sick of messing with folders. I'm thinking about setting up some sort of database to store all my snippets. Folders just aren't cutting it.
|
|
|
|
|
Keep them? I don't typically keep them. I post them here on CodeProject and it keeps them.
I would recommend using something like SnippetCompiler[^], which is handy for code snippets and even organizes them. I personally am not crazy about it because it's much slower than me doing everything with cmd.exe, vim.exe, and csc.exe. That's just me, though.
I have used it and it was pretty nice besides the performance issue (the author tried to make the UI too spiffy with inefficient code (typically that he didn't write, so you can't blame him) for something so simple).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
Oh, and Visual Studio 2005 will also feature a snippet organizer, along with ways to make your snippets dynamic and include them into code, integrating them (if you implement your snippets a certain way) with variables, methods, etc. that are already present in your code.
You should take a look at Beta 1 of Visual Studio 2005 (formerly known as "VS Whidbey") at http://www.sliver.com/dotnet/SnippetCompiler[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|