|
It seems to work, at least with .NET 1.0. The following code does what it is expected to do :
System.Xml.XmlDocument d = new System.Xml.XmlDocument();
d.Load(@"c:\opml.xml");
XmlNodeList elemList = d.GetElementsByTagName("outline");
for (int i=0; i < elemList.Count; i++)
elemList[i].Attributes.Append( d.CreateAttribute("myattrib") );
d.Save(@"c:\opml.xml");
|
|
|
|
|
|
Does somebody know how to assign and build key accelerators using C#?
Or does someone know how to activate these accelerators in C++?
|
|
|
|
|
Dear reader,
I want to write a program wich will be used as some kind of MSN-like tool to chat with other users of my LAN. Does anyone know how to build such applications using C++, Java or C#?
I think it can be done using IP-numbers!
Thank you in advance
|
|
|
|
|
There are lots of chat program sample in this site for both C++ and C#. I guess they can help you.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Hi, to build a LAN chat software is not a problem, but to analyze what you want it to do is the main thing. You can contact me for more details about this dennisroy.glofleet@gmail.com. This will be done with C# using the UDP functionality.
|
|
|
|
|
I need to write a program which uses 2 forms, one for the standard interface, and one for advanced options.
I can't write a program which asks for some information in the second form, and then passes it to the first form. I've declared the 2nd form in the first one.
How can I build a program with those two cooperating forms?
Thank you in advance,
Boudewijn Ector
|
|
|
|
|
Wouldn't that be simply be a case of declaring a public method in the second form which supplies that information, and then calling it from the first form:
class SecondForm : Form
{
...
...
public AdvancedInfo GetAdvancedInfo()
{
...
...
}
...
...
}
class FirstForm : Form
{
...
SecondForm mySecondForm;
...
...
void SomeMethodThatNeedsAdvancedInfo()
{
AdvancedInfo info = mySecondForm.GetAdvancedInfo();
...
}
}
Does that help?
Pete
|
|
|
|
|
Thanks, Pete
But I knew that already, the real problem is that my 1st form needs to know when I've entered the data in the second form. So the 2nd must somehow tell the first one that he's ready.
|
|
|
|
|
Sounds like a candidate for events. Basically form2 'publishes' a 'FormChanged' event, and then form1 'subscribes' to that event.
If you haven't dealt with events and delegates in C# before, be warned: it can be confusing at first MSDN and CodeProject articles will explain it a lot better than I can..
That said, you'll want something along the lines of:
public class form2 : Form
{
public event EventHandler FormChanged;
...
...
protected void SomeClassThatChangesForm2()
{
...
...
if( FormChanged != null )
FormChanged( this, new EventArgs() )
...
}
...
}
public class form1 : Form
{
...
...
protected void Form2ChangedHandler( object sender, EventArgs e )
{
...
...
}
...
...
public form1()
{
...
this.form2.FormChanged +=
new EventHandler( Form2ChangedHandler );
...
}
...
}
Does that make any sense at all to you
Hope it's helped a little,
Pete
|
|
|
|
|
Hi,
For ages now, I've not been able to insert ANY user controls into my windows forms, they appear on the toolbar, but when i go to insert them, it just says that it cant find the object. this is happening in all of my applications now, and even reseting the toolbar and then adding references from scratch doesn't work. has anyone had any problems like this? or any ideas of how to solve it? all my work has ground to a halt, because i use user controls all the time, and not being able to insert them, and then fiddle with the properties etc makes it very difficult. I can insert them programmatically without any errors though.
any ideas?
thanks in advance!
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I had a coworker with the same problem. His solution was to reinstall visual studio which did the trick for him.
Daniel E. Blanchard
|
|
|
|
|
I have had some luck in deleting the .suo file associated with the project. It seems that this file containes references that sometimes get out of sync with the rest of the project. Visual Studio.NET will recreate the file the next time you load the project.
|
|
|
|
|
I have asked this before but I'm asking it again (sorry):
Does a web reference require source code changes and recompilation if the URL for the web service is changed?
Does this mean that a change of an URL requires a change of namespaces?
Thank you!
Z.
|
|
|
|
|
AFAIK, the only place where the WS URL is specified in the proxy is in the Proxy's Constructor, something along the lines of this.Url = "http://foobar.com/webservice_1".
That property (WebClientProtocol.Url) is public, so you can just change it straight after the proxy is constructed, which means you don't need to recompile the proxy.
|
|
|
|
|
I'm kinda new to the properties. I saw a property example somewhere and I couldn't understand what it does. Could you please tell me what this code does? Here's the code:
public Customers Customers
{
get
{
return new Customers(this);
}
}
|
|
|
|
|
OK, if you had a class called, i don't know, Company, with the property you mentioned in it, then you could do this...
Company someCompany = new Company();
// do stuff with someCompany.
Customers someCompaniesCustomers = someCompany.Customers;
All it means is you have a property called 'Customers', which is of type 'Customers', and when you try to 'get' it (like i did in the example above) the 'get' block is executed, so in this case, it returns a new Customers object, initialsed with the company. It works the other way round too, if the source was this...
public Customers Customers
{
set
{
this.customers = value;
}
}
now you can do this...
sameCompany.Customers = someCustomers;
And the 'set' block is called. I've used 'this' to make it explicit that i'm setting a member variable, thats not actually needed, but it gets the idea across. The example you have is quite unusual however, normally the properties are much more simple, heres a better example.
public class Cat
{
protected string name;
protected string breed;
protected int age;
public int Age // Read only property, you can only 'get' it.
{
get{return age;}
}
public string Name // Read/Write property.
{
get {return name;}
set {name = value;}
}
}
this is more simple. If you've ever used C++, then they're a way of having accessors (GetAge, SetAge etc) which is more user friendly. You can do all sorts with properties, for example, if you make a user control, you can make things like the text color a property, and tell .NET to use a color selector to show the property, so more and more things can be set in design time. Have a read through the MSDN examples on properties, they're very exhaustive.
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
That was a great explanation Dave, thank you.
So if I understood it right, the code I posted has a data type of Customers (because it returns a Customers object) and it's also named Customers, am I right?
|
|
|
|
|
|
Hello,
How to fill a listview (detail mode) with one dataset (or more) ? Is it possible ?
Thanks for the response.
Frédéric
|
|
|
|
|
Databinding is not directly exposed to other controls than the datagrid, but you'll find a bunch of entry points on the web ("listview databinding" is a good keyword), including this article[^].
You will also find numerous articles filling Windows Forms controls by hand[^].
|
|
|
|
|
Question 1 (20 Marks):
Compare and contrast the int.Parse() and Convert.ToUint32() methods available in the .NET Framework. Extra credit will be awarded for RTFMs
Seriously though, what's the differences and advantages/disadvantages between the two?
Cheers,
Pete
|
|
|
|
|
Convert.ToInt32 is actually based on ... Int32.Parse.
public static int Convert.ToInt32(string value) {
if (value == null)
return 0;
return Int32.Parse(value);
}
|
|
|
|
|
Thanks!
I suspected that was the case (or vice versa)
So the only difference is that Convert handles nulls then?
BTW, if that code the actual method within the framework, or just an example of how it's probably implemented? If it is the actual method, how did you find it?
|
|
|
|
|
moredip wrote:
If it is the actual method, how did you find it
It is the actual code. Anakrino[^] (.NET decompiler which produces C# and MC++ code).
|
|
|
|