|
I have not worked with Consoles before but I am trying now.
I have an app that when you type in "setproxy none" it disables the proxy. When you type "setproxy testproxy:80" it enables the proxy.
How would I execute these commands when pressing a button?
Thanks!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
You don't have a button, it's a console app. But if you mean how does a windows app call a console app, Process.Start.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Call me stupid. What do you mean by Process.Start? I want to be able to execute some line of code from a windows app.
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
If you build a console app, you can run it with Process.Start. Isn't that what you want to do ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Maybe you want to create a windows application and handel the click event... and just place the source code from your console application into that event handler.
|
|
|
|
|
Hi! All
I have to deploy my Asp.Net, C# application using Weblogic as the application server, is it possible? If yes, please explain a little bit.
I have to use web services in my application. Its my client requirement, they don’t want to use IIS, but instead they will be using the Weblogic as the application server.
Thanks in advance for your cooperation.
keep smilling.....
|
|
|
|
|
|
Thaks for response Graus.
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|
|
hi,
i want to read one particular Xml_node in c#.net
how can i read that node
plz give sample code for that .
in the below xml file i want read <phone_no> node only
and that phone_no child nodes text is stored in listbox.
/*
<<deatails>
<<names>
<<name1>a
<<name2>b
<<name3>c
<
<<phone_no>
<<no1>9898776
<<no2>8272679
<<no3>7t8124748
<
<
<<add1>gsdghgkef
<<add2>guiqweu3r
<<add3>io34uiiju
<
<
*/
Thanks
-- modified at 2:07 Wednesday 13th September, 2006
|
|
|
|
|
Hi,
To read the XML file or string you can use the XmlDocument class which is in the System.XML namespace.
XmlDocument doc = new XmlDocument();
doc.Load("xmlstring");
doc.LoadXML("xmlfile");
XmlNode root = doc.DocumentElement;
XmlNodeList list = root.ChildNodes;
foreach(XmlNode node in list)
{
if(node.HasChildNodes)
{
XmlNodeList list1 = node.ChildNodes;
foreach(....)
{
}
}
else
{
string name=node.Name;
string text=node.InnerText;
}
}
Hope this code helps you.
Do your best to be the best
|
|
|
|
|
You would use XmlDocument, but you'd use XPath to go direct to your node, as in
foreach(XmlNode node in doc.SelectNodes("//deatails/phone_no/No"))
And to do this, you'd fix your schema and replace No1, No2 and No3 with nodes that all have the same name ( and a number as an attribute if you need it for number, but the order will never change anyhow ).
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi ,
thanks for giving helpful idea.
i try that but in, i can't get the data of node
plz check my code give any modifications.
iam new to c#.net and xml
private void button1_Click(object sender, System.EventArgs e)
{
string filename = "C:\\C#program\\cs_programs\\singlenode\\bin\\Debug\\nodexml.xml";
XmlTextReader tr = new XmlTextReader(filename);
XmlDocument doc = new XmlDocument();
while(tr.Read())
{
foreach(XmlNode node in doc.SelectNodes("//details/add/addr"))
listBox1.Items.Add(doc.Value);
}
}
|
|
|
|
|
Like I said, your schema is useless. You need to change the addr1/addr2/addr3 nodes to all be just addr. And don't forget, XML is case sensitive.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi Christian
i new to c#.net
i want to access one node in xmlfile using c#.net .
that node have child node (i want that child node values)
i write my xml file like this
<
<<name>
<<n>Ap
<<n>MP
<<n>UP
<
<<add <<addr1="">gjsefgjkl<<addr2>dfhtyxcvd<<addr3>ioiopweri
<
in this i want to access the "add" child node value.
i wrote c#.net code like this,
"When i press Button the childnode("add") values r stored in listbox "
plz change any modification in my code or plz give code how to access thatnode
private void button1_Click(object sender, System.EventArgs e)
{
string filename = "C:\\C#program\\cs_programs\\singlenode\\bin\\Debug\\nodexml.xml";
XmlTextReader tr = new XmlTextReader(filename);
XmlDocument doc = new XmlDocument();
while(tr.Read())
{
foreach(XmlNode node in doc.SelectNodes("//details/add/addr"))
listBox1.Items.Add(tr.Value);
}
}
Thanks
|
|
|
|
|
Well, if you want to access the add node, just drop the rest of the XPath - /details/add
If you want to get all the addr nodes, name them all addr, as I advised you to do in the first place.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi. I have written a code that has no recursive function in Visual Studio.NET 2003(C#). It personalize a smart card. After it personalize some cards(24 for one system, 60 for the other, 18 for another), it ends with a stackoverflow exception. I use WndProc in my project. When the unhandled exception occurs, it breaks in the end of WndProc. How can I find when this error occurs and how can I solve this error?
Thanks in advance
|
|
|
|
|
your program is recursive in some way, which is causing the problem. It doesn't have to be a single method that is recursive, it might be methods that call each other in turn.
The only time the stack usage changes is when you call a method, and when you return from the method the stack usage returns to the previous state. That concludes that the only way to get a stack overflow in the way that you do is to call methods that you never return from.
---
b { font-weight: normal; }
|
|
|
|
|
hi all,i need to find the number of printers connected in the network(for printing crystal report) and i need to load it in dropdown list is it possible?..if yes tell me how...
ayyp
|
|
|
|
|
Hello
I can't remember all details now, but below code can help you.
Please add to your project PrintDocument Control from toolBox and name it printDoc.
<br />
using System.IO;<br />
using System.Drawing.Printing;<br />
using System.DirectoryServices;<br />
<br />
string strDefaultPrinter = printDoc.PrinterSettings.PrinterName ;<br />
<br />
foreach(String strPrinter in PrinterSettings.InstalledPrinters)<br />
{<br />
listboxPrinters.Items.Add(strPrinter);<br />
if (strPrinter == strDefaultPrinter)<br />
{<br />
labelSysDefPrinter.Text = strPrinter ;<br />
}<br />
}<br />
but notice that I think you should first add network printers from Start Menu \ Printers and Faxes.
|
|
|
|
|
no...it display only one printer... but my network has 2 printers...and in my system it contain 2 printers(setting-->printer-->)
ayyp
|
|
|
|
|
in an editor when I will click the new submenu,a dialog box will appear where I can put the filename.so when I will click the the save button in the dialog box,whatever the file name entered that will appear on the main menu.like internet explorer whatever URL we are entering that is appearing on the main menu .How to do it
|
|
|
|
|
The way you word these, it sounds like you're reading them off your spec documents at work.
sarojkumarjena wrote: How to do it
http://www.c-sharpcorner.com/winforms/MenusFunctionalityGAG.asp[^]
That was my first google hit, by the way. So, you just add the menu items according to what you're shown on that page.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
my problem is not adding the menu items.When I will click the new submenu,a dialog box will appear
where I will enter the filename.When I will click the ok button of the dialog box,that filename will appear immideately on the main bar
|
|
|
|
|
OK, I have some questions
1 - are you being paid to write this code
2 - are you typing these questions in from your clients specification
3 - what part of what you typed above is confusing you
4 - how long have you been coding for
The best long term answer to this specific question kind of depends on how you answer my questions.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|