|
I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP that is entered. What's up Microsoft????
I can say that before we switched over .NET 1.1 to 2.0 the Dns.Resolve(entry); would find a name for any IP, LAN or WAN.
Q. Any ideas??????????
[This is new .NET 2.0 method that replaced the former .Resolve method]
private void LookupIP(string entry)
{
try
{
IPHostEntry IP = Dns.GetHostEntry(entry);
txtBox2.Text = IP.HostName;
}
catch(Exception exception)
{
|
|
|
|
|
when i add a control to a form it adds to Location(0,0)
but if i have a menu on my form it adding it to Location(0,0) is under the menu so i need to offset Location(0,menuheight)
how to handle situation like this ?
i've been using this.ClientRectangle to set Location
|
|
|
|
|
I'm making a C# app that does alot of xpath queries, and I was having trouble with one. Here is the xml I am working with:
<?xml version="1.0" encoding="utf-8"?>
<reviewers>
<reviewer>
<name>Matti Latva-aho</name>
<email>asf@asf</email>
<country>Finland</country>
<affiliation>University of Oulu</affiliation>
<username>matla</username>
<password>19harava</password>
<interests>
<interest>Track II</interest>
<interest>Track IV</interest>
<interest>Track III</interest>
</interests>
<papers>
<id>1</id>
</papers>
</reviewer>
</reviewers>
My question is how can I get - using XmlNode.SelectNodes() - get all the "reviewer" nodes with "id" node that is equal to a number x. ???
Using the below expression I can get the papers node with the id that I specify, but I want the parent of papers, reviewer.
XmlNodeList reviewerNodes=docReviewers.SelectNodes("//reviewers/reviewer/papers[id='"+p.id+"']");
/\ |_ E X E GG
-- modified at 18:33 Saturday 11th February, 2006
|
|
|
|
|
How about:
/reviewers/reviewer[papers/id = '1']
|
|
|
|
|
Thanks, I also discovered
"//reviewers/reviewer/papers[id='"+p.id+"']/parent::*"
works too.
/\ |_ E X E GG
|
|
|
|
|
-<papers>
<id>1</id>
<id>2</id>
</papers>
I want to select an id based upon it's value..
What is an xpath expression to get an id=1 or 2???
I'm not sure how to get to the child elements id from papers by the id value.
/\ |_ E X E GG
|
|
|
|
|
i have aproblem using LIKE and % with stored procedure.
row:
022533228 ahmed shabana
stored procedure:
CREATE PROCEDURE sel_cust_servtel
(
@servtel char(9)
)
AS
select *
from cust
where serv_tele LIKE @servtel
Query:
exec sel_cust_servtel '%2533228' ------> return nothing
exec sel_cust_servtel '%22533228' ------> return the row
that mean it work only for one character which is not supposed to do.
|
|
|
|
|
Please see the answer I gave you in the SQL Forum[^].
Also, this post has nothing to do with C# so it does not really belong in this forum at all.
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
|
|
|
|
|
I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP that is entered. What's up Microsoft????
I can say that before we switched over .NET 1.1 to 2.0 the Dns.Resolve(entry); would find a name for any IP, LAN or WAN.
Q. Any ideas??????????
[This is new .NET 2.0 method that replaced the former .Resolve method]
private void LookupIP(string entry)
{
try
{
IPHostEntry IP = Dns.GetHostEntry(entry);
txtBox2.Text = IP.HostName;
}
catch(Exception exception)
{
|
|
|
|
|
hi,
the following three lines are working for me & successfully resolves an IP to hostname.you are probably missing the second line i.e you are not parsing the string to an IPAddress.
IPAddress ipis;
ipis = IPAddress.Parse(address);
string hostname = Dns.GetHostEntry(ipis).HostName;
try this and then see what happens.
|
|
|
|
|
No didn't work for me either.
Be sure your workstation is:
a. Windows XP Pro (sp 2)
b. VS2005 .NET
c. .NET 2.0
So far I'm using the GetHostByAddress method, although I recieve a 'yellow' warning during the compile, it does still compile and not halt in error like the Resolve method does now since .NET 2.0. The program will open and run as usual. However, I would like a flawless code like before the .Resolve obsolecsence.
string hostname = System.Net.Dns.GetHostByAddress(IPAddress.Parse(entry)).HostName;
|
|
|
|
|
Is there a way to designate a property as only being usable say, during serialization? For example, I need a setter that sets the string value during deserialization, but under no other condition should this setter ever be used.
I really miss the "friend" feature of C++.
[edit]I'm using C# 2.0, if that helps.[/edit]
Marc
Pensieve
-- modified at 14:00 Saturday 11th February, 2006
|
|
|
|
|
Well, I came across a way of doing this by accident sometime ago while I was exploring something else. However, I can't remember exactly what I did now! Some combination of attributes and reflection.
Kevin
|
|
|
|
|
If you are using binary serialization, the visibility of the property doesn't matter, because the serializer uses the (private) fields.
Xml serialization is different. You could use the OnDeserialized attribute to execute a method whoch sets a boolean flag. In the setter, check the flag and throw an exception.
|
|
|
|
|
In VC++ was the #pragma warning directive, for example:
#pragma warning( push ) // Store the current warning level for all warnings
#pragma warning( disable : 4705 )
#pragma warning( disable : 4706 )
#pragma warning( disable : 4707 )
// Some code goes here...
#pragma warning( pop ) // Pops the last warning level
Is there any directive in C# that do the same job?
Thanx in advanced!
|
|
|
|
|
Project Properties -> Configuration Properties -> Suppress Specific Warnings
Kevin
|
|
|
|
|
THANX kevin, however - this setting is global to the project, to supress specific warning in specific portion of code and the restore it - now i have learned (by the other replyers of this post) that it is possible in .net 2.0 framework.
Regards, ilan
|
|
|
|
|
Cool. I didn't know that.
Kevin
|
|
|
|
|
I believe you can only do this using v2.0 of the .Net Framework
#pragma warning disable 0169, 0414
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
This is documented right here[^]. This is NOT SUPPORTED in C# 1.0 and 1.1. This is a new capability introduced in C# 2.0.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
i am using the following function to close some open forms with tag "NOTMAIN" in my application.
private void CloseOldForms()
{
FormCollection frmColl = Application.OpenForms;
foreach (Form tempFrm in frmColl)
{
string tempFrmTxt = tempFrm.Tag.ToString();
if (tempFrmTxt.Equals("NOTMAIN"))
{
tempFrm.Close();
}
}
}
But after looping one time in foreach loop,the application stops with an exception i.e enumeration was modified operation may not execute.
So can anybody tell how can i do the task
|
|
|
|
|
The call to tempFrm.Close() modifies the Application.OpenForms property. Try this:
private void CloseOldForms()
{
ArrayList frmColl = new ArrayList();
frmColl.AddRange (Application.OpenForms);
foreach (Form tempFrm in frmColl as Form) {
string tempFrmTxt = tempFrm.Tag.ToString();
if (tempFrmTxt.Equals ("NOTMAIN")) {
tempFrm.Close();
}
}
}
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Try this instead:
private void CloseOldForms()
{
FormCollection frmColl = Application.OpenForms;
foreach ( int i = 0; i < frmColl.Count; ++i )
{
Form tempFrm = frmColl[i];
string tempFrmTxt = tempFrm.Tag.ToString();
if (tempFrmTxt.Equals("NOTMAIN"))
{
tempFrm.Close();
}
}
}
I'm not absolutely sure of this, but I think that when you call Close on your form, it is attempting to remove the form object from the form collection automatically which is what causes this error since you are at that point in effect trying to alter the contents of the collection over which you are iterating.
Hope that helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
perlmunger wrote: foreach ( int i = 0; i < frmColl.Count; ++i )
This WILL cause an IndexOutOfRange exception. The solution is very easy, but not so obivous:
foreach ( int i = frmColl.Count; i >= 0; i-- )
Run the the loop in the other direction! Start at the end and work your way back to the front...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 14:47 Saturday 11th February, 2006
|
|
|
|