|
hi
this is my code which is working fine
but when i want to put user defined value from textbox to @name='here ib place of ram'
i get a sysntax error
XmlDocument doc = new XmlDocument();
doc.Load("c:/farm-config.xml");
xmlNode farm2=doc.SelectSingleNode("/root/farm-config/farm[./@name='ram']/connection/@address");
MessageBox.Show("sanjeev" + farm2.InnerText);
This is working fine
when i modify code
it gives some syntax error
xmlNode farm2=doc.SelectSingleNode("/root/farm-config/farm[./@name="+ textBox1.text + "]/connection/@address");
i tried this one also
xmlNode farm2=doc.SelectSingleNode("/root/farm-config/farm[./@name='"+ textBox1.text + "']/connection/@address");
can anyone correct me
this is my xml file sturcure
<?xml version="1.0" encoding="UTF-8"?>
<root>
<farm-config>
<farm name="good">
<connection address="localhost" user="god1" password="mad">
<lastjob>Copy-All</lastjob>
<lastconnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
<farm name="sanjay">
<connection address="127.0.0.1" user="dog" password="cat">
<lastjob>Copy-All</lastjob>
<lastconnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
<farm name="ram">
<connection address="localhost1" user="root" selectedConnection="1" password="daask">
<lastJob>Copy-All</lastJob>
<lastConnection startdate="2005-05-10" starttime="12:43:23" enddate="2005-05-10" endtime="12:58:32" />
<state>1</state>
</connection>
</farm>
</farm-config>
</root>
regards
sanjeev
|
|
|
|
|
Well Sanjeev, everything seems fine.... but there is one glitch which might be causing this problem. Since you are picking value from a textbox, perhaps there are trailing spaces in it. Why dont you first extract value from textbox, trim it and then try to find that node.
Like you can do this.
string strdata = Convert.tostring(textBox1.text).trim();
xmlNode farm2=doc.SelectSingleNode("/root/farm-config/farm[./@name='"+ strdata + "']/connection/@address");
Hope this resolves the problem!!!
Ali
http://aliwritings.blogspot.com/
|
|
|
|
|
I am developing a C# application with a form contains 3 comboboxes and all the 3 combo should get its data from a different fields in different tables in my database..
How can run this statement in C# with the faster performance?
Jassim Rahma
|
|
|
|
|
Run exch one on a seprate thread.
|
|
|
|
|
I have a solution that contains 4 projects. The main project is entitled Majo, which uses the Majo namespace IE:
namespace Majo
{
public class Majo : System.Windows.Forms.Form
{
...
In the Components project I have the following declaration:
namespace Majo
{
namespace Components
{
public class ImageComponent : PictureBox
{
....
The problem is I need to have access to the Majo class within the main Majo namespace, but if I just use Majo from the Components namespace, I get a
'Majo' denotes a 'namespace' where a 'class' was expected
How can I gain access to the Majo class from Components? Thanks.
|
|
|
|
|
Majo.Majo majo = new Majo();
IMO you'd do better to change the namespace name, it's potentially confusing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I still get a
The type or namespace name 'Majo' does not exist in the class or namespace 'Majo' (are you missing an assembly reference?)
error if I attempt to use Majo.Majo. Is there someone I have to do to be able to reference the main class?
|
|
|
|
|
methodincharge wrote:
Is there someone I have to do
LOL - I assume this is a typo.
I would still recommend changing the namespace name. Other than that, it's a strange problem, I'd expect it to work that out for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
For some URLs (e.g.http://v3.espacenet.com/origdoc?DB=EPODOC&IDX=WO2005028634&F=0&QPN=WO2005028634), the content length for the HttpWebResponse I get with request.GetResponse in empty. The response.GetResponseStream() also empty.
Here is the code snippet:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(pageAddress);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
string pageData = sr.ReadToEnd();
The Content Type for the response is "text/html; charset=iso-8859-1" and the HttpStatusCode was OK.
What am I missing?
|
|
|
|
|
hi to all,
is there a way to embed a 'live' preview of what is being captured into a windows form ?
rather than launching the twain interface then capturing and sending the captured data back to the form ?
tutorial or similar would be nice
have looked at leadtools & imagXpress but they launch the third party twain interface
kind regards
g00fy
|
|
|
|
|
There's no TWAIN support built in to the .net framework.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
does this mean it is impossible to do this ?
regs
g00fy
|
|
|
|
|
It means no matter what happens, you need to write a TWAIN implimentation, or buy one. Once you do that, I see no reason why you can't render the image being scanned where ever you feel like it, assuming you have that level of control in the code you buy, or write it yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well thats wot i thought, however i downloaded a trial of imageXpress and i cannot see anyway to avoid the twain interface appearing as a secondary process.
note: twain interface in this post refers to the UI not the hardware interface
what i would like is capture froma a twain camera (acting as a web cam), and if the person moves then this is reflected inside the windows forms application. and capturing of the 'video' will result in a still being placed in the same location (or other...)
however, my current implementation..
when you click acquire it pops up the twain interface (where the above description takes place, as opposed to inside the c# app) and on clicking 'get pictures' or similar, the picture is sent back to the windows forms app.
this is what i am trying to acheive and i have googled for a long time and found no suggestion that this is possible, however i assume it is as the twain interface itself is doing this.
kind regards,
g00fy
|
|
|
|
|
I was looking at this[^] the other day and it seems good. I haven't researched further because I haven't had much time, but it might work for you.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
g00fyman wrote:
however i downloaded a trial of imageXpress and i cannot see anyway to avoid the twain interface appearing as a secondary process.
Yeah, well, that's generally how it's done, so that's probably what they support.
g00fyman wrote:
what i would like is capture froma a twain camera (acting as a web cam), and if the person moves then this is reflected inside the windows forms application. and capturing of the 'video' will result in a still being placed in the same location (or other...)
Doesn't DirectShow let you do this ?
g00fyman wrote:
however i assume it is as the twain interface itself is doing this.
Yeah, I'd assume so, too. But I've never done anything like this, when I did TWAIN stuff, it was for a scanner, with the sort of interface you suggest.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thank you both,
i will keep going, i was mainly checking that it was not impossible,
ill be sure to let *everyone* know how its done when completed.
regs to all
g00fy
|
|
|
|
|
g00fyman wrote:
ill be sure to let *everyone* know how its done when completed
An article good be a great way of letting us know! good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
no problem there,
that link u posted uses same 'traditional methods' of acquisition
regs
g00fy
|
|
|
|
|
Well, everytime I've scanned uses the "traditional" method. From any Office application, Paint Shop.... so I don't think it's so bad for scanning.
There's an article here I saw a few days ago about using DirectShow to capture images from a webcam. I quickly searched for it but I couldn't find it. Maybe if you searched more deeply.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
The following code crashes when I try to pass an image
______________________________________________________________________________
private void zoomin_Click(object sender, System.EventArgs e)
{
dxfviewer.Image =ScaleByPercent(dxfviewer.Image,50);
}//end function
static Image ScaleByPercent(Image imgPhoto, int Percent)
{
float nPercent = ((float)Percent/100);
int sourceWidth = imgPhoto.Width; //with is null when passed this way
int sourceHeight = imgPhoto.Height;
int sourceX = 0;
int sourceY = 0;
_____________________________________________________________________________
Any thoughts on why this happens.
Thanks
|
|
|
|
|
Reanalyse wrote:
imgPhoto.Width; //with is null when passed this way
You need to add code to check if imgPhoto is null then, in which case, you have no image to scale and need to just return null.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How do you refer to a control that belongs to a different class within the same namespace?
I have two classes one is named Form1 and the other is named MyClass.
I created a RichTextBox in Form1 and set it's access to Public
When I try to refer to it from within MyClass like so:
Form1.richTextBox1.Text = "";
It tells me that i need to create a reference. How can I do this without setting the control to be a static control?
|
|
|
|
|
The problem is that unless the form is visible, the richTextBox is null, it gets created as the form is created. You should name it something meaningful, make it private, and add a public property for the string. Then in your initialisation code, set the text to equal the value of that string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
in source code you type( using calasename)
then let you to use public object in calss
|
|
|
|