|
To show the IP Address(es) of the local computer add:
<br />
string hostName = SystemInformation.ComputerName;<br />
System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByName(hostName);<br />
System.Net.IPAddress[] adresses = hostEntry.AddressList;<br />
foreach (System.Net.IPAddress curAdd in adresses)<br />
{<br />
MessageBox.Show(curAdd.ToString());<br />
}<br />
Sincerely,
-Ron
|
|
|
|
|
But if there are 20 computers in my local network,
and a must now how from it's are online.
confused:
|
|
|
|
|
But if there are 20 computers in my local network,
and a must know how from it's are online.
confused: 
|
|
|
|
|
I use the Dns.GetHostByAddress method to determine if a computer is online. If not this method throws an exception. I'm not sure which exception this is, but it think you will find out by testing.
I think that the Dns.GetHostByName method which i mentioned shows a similar behaviour.
|
|
|
|
|
If you want the ip address of all the machines in your workgroup you will have to use a file called netapi32.dll, you will have to extract data from it.
Alternatively you could try to resolve a range of ip address and the address that get resolved could be added to an array. That array could be the list of hosts that are available in your network. You could use the Dns.GethostbyAddress method for it.
CCIE (R&S) Written, MCSE 2000 Security
|
|
|
|
|
Thanks, but how can i use this netapi32.dll in C# to know
what of network computers are online.
confused:
|
|
|
|
|
I have a base-class form with buttons on it. If I derive from this form, I want to be able to click the buttons at design time, and react to the clicks. Any ideas?
Thanks in advance.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
By default the scope of the buttons etc in the form are private. Change the scope to public or protected so that u can interact with the designer
|
|
|
|
|
Hi there. Thanks for the reply. I tried that, actually, and all it did was allow me to modify the buttons from the inherited class. I still couldn't get the buttons to raise click events.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
I cant get what u r asking. By modifying the scope u can handle the click event in the derived form.
Raising the click event by using OnClick is only possible in the classes derived from the Button Class.
As per my knowledge, u can do everything for the Button in the inherited form class as u do in a form class.
|
|
|
|
|
Hello,
I am new to C#, and my background is mostly C++.
also just started with the MS Developer Studio for .NET, and no where did i
find how to get the list of derived classes from a given class/interface.
i also have multiple assemblies (each on a different sln file) in the environment
i work in, which might make things a bit more difficult.
thanks for any suggestion
Adi
|
|
|
|
|
There's no way of which I know to do it directly. I haven't played around much with the Visio version that comes with VS .NET Enterprise, mostly having used it for database reverse-engineering; maybe that has some facility for auto-generating class diagrams?
One thing you can do is execute "Tools - Build Comment Web Pages...", and browse around the generated HTML. It's not the best solution, but it'll work.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Visio Professional does add a toolbar to VS.NET for reverse engineering your projects as well, yes.
For a better documentation generator, see NDoc[^] - a free documentation generator that produces many different output formats similar to the MSDN Library / .NET Framework SDK documentation, and is used by many large companies.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I just tried the "Build Comment Web Pages", and it doesn't seem to include that stuff. You can definitely use NDoc to do this, though. It'll generate MSDN-style documentation (or you can pick another style), and you can browse the generated help file in the way you need.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Oops - we posted this at the same time!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yep. I was pretty amazed not to find the feature built in, but then I thought I'd try to make things as easy on him as possible. I think it's a good idea for everybody to learn how to use NDoc, I guess.
I wonder why the structure and formatting of the "comment web pages" is so bad. If you were developing that feature, wouldn't you have made them look just like the MSDN documentation? It would've made projects like NDoc unnecessary for most people. Or is there some way to provide your own custom documentation formatter plugin in VS .NET?
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Thank you guys, that helps a lot
Adi
|
|
|
|
|
Hi Adi,
The best tool which is used is Reflector.Net [1]. It solves most of the functionality which vs.net object browser does not.
[1] http://www.aisto.com/roeder/dotnet/
|
|
|
|
|
Hi!
How can one convert a byte array to a string when the encoding method of the byte array is unknown?
Background: I am trying to download files from the web (like this) and get a byte array as result. Now I want to get this somehow into a string object.
Any way to do this?
Thanks in advance and best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Something like this:
byte[] outData =blah blah;
StringBuilder s = new StringBuilder();
for(int i=0 ; i<outData.Length;i++)
{
s.Append(outData[i]);
}
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
I haven't tried this yet, but are you sure that this will support UTF-8 encoding for example? You explicitely add each byte as character to the string (Append function), wouldn't this destroy the UTF-8 encoding (treating a two-byte-or-more encoded character as several different ones)?
Thanks for your reply,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Use System.Text.Encoding.UTF8.GetString(byte []).
You can use other encodings, too, see the System.Text.Encoding class help for this.
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...
|
|
|
|
|
To get the content encoding from the response from the server, you can use the HttpWebResponse.ContentEncoding parameter. You can then conditionally use the appropriate Encoding class that Daniel mentioned to get the string from the byte[] array.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ahh, now that's a solution Thanks Heath!
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Dominik Reichl wrote:
Any way to do this?
Just anothing way:
string str = "Hello";
byte[] buffer = System.Text.ASCIIEncoding.GetBytes(str);
- Nick Parker My Blog | My Articles
|
|
|
|