|
I am interested in a way, using the .NET Framework classes, to obtain a MAC address based on an IP number. Knowing an IP number, I need to know to extrapolate the MAC address. How can this be done with the .NET Framework and C#? I know that the MAC is not in the Request object, I need some guidance on getting the MAC *after* I have used the Request object to get the IP number. I have found some about using the "System.Management" Namespace already.
I'm assuming the machine running the function and the remote machine we are trying to obtain the physical address of are on the same network segment and are not separated by a firewall.
Any thoughts about a solution to the problem?
|
|
|
|
|
Well, you can use the script code above with 2 changes.
Change:
string sComputerName = ""; // The hostname
To:
string sIPaddress = "";
and change:
p.StartInfo.Arguments = "/C nbtstat -a " + sComputerName + "";
to:
p.StartInfo.Arguments = "/C nbtstat -A " + sIPaddress + "";
Note the capital A in the last line.
Good luck.
|
|
|
|
|
Hello,
I´m trying to use the SQL Server 2005 Express in my C# 2005 Express Project and I´m getting nuts! In my project I created the Tables I need but know I really don´t know hoe to establish a connection and make select or insert statements?! In the learning Videos from microsoft the do everything with Databinding in the Designer but I have to leran how to make those things manually by code. In my Book about c# they use OleDBConnectio, OleDBDataReader and OleDBCommand to connect and work with an Access MDB. But I have to use SQL Server. In other examples I found they use DataAdapter...an I really don´t know what´s the correct way? Is there anywhere a simple example that shows how to connect to a local installed SQL Server and make a select statement, show the Data from the selectstatement in a grid or something else and make in insert into a table? Or can anyone show me how to do that? Normaly it´s not my way to ask such questions but I really become nuts and be doubt about my programming knowledge...
Thank you very much
twickl
|
|
|
|
|
|
Hi!
Yes, starting can be a bitch...
You can't say one choice is "the correct" way, because you can achieve what you want in many different ways.
You can use the OleDB* classes to communicate with a SQL Server just like you would with Access. The only thing that's different (in the beginning, at least) is the connection string you'll have to specify.
With an mdb file you just include datasource='...path to your file...', but that doesn't work with SQL server.
Since I can't remember all the parts of a connection string for a given database, I usually take a look at http://www.connectionstrings.com/[^] to find the correct connection string.
Everything else is just a matter of reading the class documentation...
Regards,
mav
|
|
|
|
|
Hi Guies,
How to read integer from keyboard in C#.
Thanks in Advance...
|
|
|
|
|
For console programing you hava to use
using System.Console.;
& then use
ch = System.Console.Read(); //return charater
Or
str = System.Console.ReadLine(); //return string
Divyang Mithaiwala
with Best Regards
|
|
|
|
|
I want to take integer value and not char or string.
Actually System.Console.Read() reads kay pressed and not int.
|
|
|
|
|
Then use int.Parse() to convert it.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"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
|
|
|
|
|
if you are trying to accept only numeric values in your text box, you can use the e.Handle = true of KeyPressEventArgs to cancel the keypress event.
You can try the code below.
string strnum = "0123456789";
if (strnum.IndexOf(e.KeyChar.ToString())<0)
{
e.Handled = true;
}
|
|
|
|
|
i m working with InternetExplrer for that i m using ShDocVw.dll.following coding is used to get the reference to currently opened browsers. what i m doing is putting the entry of brower in listbox.for e.g suppose i write www.yahoo.com in address bar then i put www.yahoo.com in listbox. in the following code ie.LicationURL return the website name in my case www.yahoo.com as i mentioned above. what i did is put all th entries of opened browser into the listbox.when i click on any of the URL in list box . what would i like [b]shows that browser on TOp of all other browser.[/b] for that i used the following coding...
foreach (SHDocVw.InternetExplorer ie in shellWindows)
{
string filnam = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
if (filnam.Equals("iexplore"))
{
if(this.listBox1.SelectedItem.ToString().Equals(ie.LocationURL))
{
MessageBox.show(ie.LocationURL.ToString());
// what code should be here to put the browser on top
}
}
}
Above mentioned code is working fine but is not giving desired ouput
Amit Grover
CDAC R&D
|
|
|
|
|
Can anyone tell me how, if it is possible, to pass a method as an argument for another method?
|
|
|
|
|
Hello,
Firstly define method type:
public delegate int TypeName([Type arg[,[Type arg,...]]]);
This is your method type.
Now define one object of this type
private TypeName myObject;
& also define one method which has declaration as your method type
Note: Object & method are different so use different names for them.
Now initialize object
myObject = new TypeName(MethodName);
now you can pass this object as argument & use same methodtype for calling method for that argument.
Divyang Mithaiwala
with best regards
|
|
|
|
|
Thank you Divyang Mithaiwala, very much appreciated.
|
|
|
|
|
Use a delegate:
class A
{
public delegate void SomeDelegate();
public void MethodWithDelegateParam(SomeDelegate del)
{
del();
}
}
and in client code:
class B
{
public void MyMethod()
{
DoSomething();
}
public static void Main()
{
B b = new B();
A a = new A();
a.MethodWithDelegateParam(new A.SomeDelegate(b.MyMethod));
}
}
[^] For more information.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Thank you Michel Prévost, very much appreciated.
|
|
|
|
|
I am working on a web browser project, i have done the work as when new tab button is clicked, a new tab is created with a browser, but the navigation occurs only in the first tab browser. Is there any way to correct it?
|
|
|
|
|
I don't have the detail of your project and what technology you are using to achieve the display of HTML, but I suspect that you don't keep track of the currently active tab page. What I suggest is that you have a private variable that keeps track of all the tab pages (a collection, for instance) and another one to keep track of the current tab page index. When the user creates a new tab, update your variables accordingly.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I am working with C#.NET windows application & using the explorer given in the tools to navigate.
|
|
|
|
|
I keep getting the above message on a C# program.
What assembly/namespace have I missed?
|
|
|
|
|
If you had checked the documentation for the DescriptionAttribute class, you would have seen that it's in the System.ComponentModel namespace.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I would please like anyone's help. I need to convert any .PDF file into a .EMF. Enhanced Meta File. The reason being is so that I can edit and manipulate this PDF's data. I need something this is preferably free and code available.
Any help will be greatly appreciated. Tks
-- modified at 3:20 Friday 20th January, 2006
|
|
|
|
|
I wrote a small web application that will be used by few people. I would like to write a small program to install it to different computers. I am very new in this industry so any idea how I can do that
|
|
|
|
|
A WEB application? You can still create an installer, but the app is installed to the IIS Server, not the clients.
All you do is add a Setup project to your Solution. Right-click the Solution in the Solution Explorer, select Add New Item. Under "Other Project Types", you'll find Setup and Deployment. Setup Wizard would be a good one to pick for your first time doing this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for replying.
I did just that and the options I get when I select Add New Item doesn't
give me the option "Other Project Types". I right clicked on the solution.
Is there anything I am doing wrong
|
|
|
|