|
The best thing to do is to return the XML as a string . The client can then do whatever it wants with it. In your case, the XML can be written out in a HTTP Response. IE will display it using its own XML Viewer.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi Paul,
Thanks for the reply. Here is what I am doing--pretty simple.
I have a class which writes records to an xml file. It has one public method called GetXmlContents() which will return some type (you reccommended a string). The client is a simple Windows Form which has a button Called "View Xml". Within the button's click handler I want to display the contents using IE.
How can I do this?
|
|
|
|
|
This link[^] shows you how to invoke IE from a .NET app and get it to display a document. In your case, you would need to save the XML to a file and then pass the absolute system path to your XML file in the url argument.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Yes
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thank you, but what does it do that VS2005 doesn't do or doesn't do as well that warrants a purchase?
Thanks again.
|
|
|
|
|
Read this article[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Purchase? Go to your local roll-out event and get it free.
|
|
|
|
|
Im trying to use an active port to send tcp packets..
i know that its possible because the program WPE Pro do it..
WPE Pro attach some process and get all packets that pass through this process..
and use this connection to send edited packets..
how i do it?
sorry bad English =P
thankz..
msn: julinn@msn.com
|
|
|
|
|
Hi
I am creating dll using C#. I made the research and little bit confused with following:
1) does all the classes need Guid?
2) Does all the class need interface classes? or can I have just regular class without interface and Guid?
[Guid("....")]
public interface myclass_interface
{
....
}
[Guid("...."),
ClassInterface(ClassInterfaceType.None)]
public class myclass_class:myclass_interface
{
..
}
3) Can library have static function/procedures so other classes can call them directly?
Thank you.
|
|
|
|
|
1 - Not unless you want to create a COM dll
2 - depends, are you creating a COM dll ?
3 - I don't see why not
Why do you want to create a COM dll, or are you thinking you have to ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm making an Instant Messenger using my new knowledge of Sockets. When the client connects to the host, it tells the host its username. If it's okay (not in use), the client asks for the list of online users. The host replies with an array of bytes and it's converted into an array of strings. I checked the values in the array for set. Now since I would get a cross-threaded call exception I used lsb_users.Invoke so that it would execute on the right thread, (see code):
public void AddUsernameToList(string username)<br />
{<br />
if (this.lsb_users.InvokeRequired)<br />
{<br />
this.lsb_users.Invoke(new MethodInvoker(delegate { AddUsernameToList(username); }));<br />
return;<br />
}<br />
this.lsb_users.Items.Add(username);<br />
}
I set a breakpoint on "this.lsb_users.Items.Add (username)" and it is adding, I hover over Items and it says there are two (which is correct: host username and client username). However in the form there's nothing in the list. Would there be some reason for the listBox not to update? Also something extra: when a client connects to the host it updates the same listbox on its end and it works just fine.
[Edit]
I have a Room class which extends Form, the Room class has the listbox mentionned above as well as the method mentionned above.
HostRoom extends Room and ClientRoom extends Form so the same method is being called. For some reason in ClientRoom nothing is happening.
[/Edit]
Thanks.
|
|
|
|
|
Jordanwb wrote: However in the form there's nothing in the list. Would there be some reason for the listBox not to update?
Use this:
this.lsb_users.update();
Som
|
|
|
|
|
Ok I'll try that when I get home from school but there's still the question: Why did it work on the host end but not on the client end?
[Edit]
I tried and it didn't work.
[Edit #2] I don't know what happens but it works now. I'm not sure if calling the Update method was the fix. [Checks] No that wasn't it.
Thanks anyways.
modified on Tuesday, March 25, 2008 5:57 PM
|
|
|
|
|
I've created access database name Club having table info,in table info there is one field name "EndDate".
i want to fetch those records whose EndDate value is todays systemdate and it will display in datagrid.
please help me with query .
thanking you
|
|
|
|
|
Just run a query on the database and add a WHERE clause to limit your results.
You will get a dataset back and then bind that to your datagrid or datagridview.
If you don't know how to do either of these, go back to school.
|
|
|
|
|
Can you please tell me whether this query is correct,when i'm trying this query error is coming.
String query = "select * from info where EndDate= " + DateTime.Today.ToString ();
|
|
|
|
|
Hey im back with a new questions / problems
Question 1:
I have a image that is in a picturebox which is called pictureBox1
I want to read monstersetbase.txt and add small ellipses to my image. The position of the ellipse comes from my monstersetbase.txt. The image is 256x256 and the coordinates is example 125x150.
I figured out a way to write a ellipse on the picturebox. It looks like this:
public void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
System.Drawing.Graphics g = e.Graphics;<br />
g.DrawEllipse(System.Drawing.Pens.Red, 125, 150, 2, 2);<br />
}
And on my form load:
public void Form1_Load(object sender, EventArgs e)<br />
{<br />
pictureBox1.Paint += new PaintEventHandler(this.pictureBox1_Paint);<br />
this.Controls.Add(pictureBox1);<br />
}
Now my problem is that I cant seem to figure out how to read the txt file properly when I need all the data
If I use for example:
public void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
String line;<br />
String data;<br />
<br />
System.Drawing.Graphics g = e.Graphics;<br />
<br />
using (StreamReader sr = new StreamReader(Convert.ToString(@fileLocation)))<br />
{<br />
while ((line = sr.ReadLine()) != null)<br />
{<br />
data = Convert.ToString(line);<br />
<br />
String[] piecesMap = data.Split('\t');<br />
<br />
float xCord = float.Parse(piecesMap[3]);<br />
float yCord = float.Parse(piecesMap[4]);<br />
<br />
g.DrawEllipse(System.Drawing.Pens.Red, xCord, yCord, 2, 2);<br />
}<br />
}<br />
<br />
}
then im getting the error:
Index was outside the bounds of the array.
Any suggestions?
My monstersetbase.txt:
3<br />
0 0 30 78 60 240 240 -1 5
1 0 30 185 132 185 132 -1 10
2 0 30 183 128 188 135 -1 10
3 0 30 10 10 240 240 -1 12
4 0 30 10 10 240 240 -1 8
5 0 30 185 132 185 132 -1 7
6 0 30 132 83 132 83 -1 10
7 0 30 183 128 188 135 -1 6
8 0 30 132 83 138 90 -1 10
end<br />
1<br />
9 33 10 85 162 95 168 -1 5
10 29 30 40 113 45 116 -1 3
11 41 5 126 160 125 161 -1 2
12 38 5 106 161 111 160 -1 2
end
78 and 60 is the x and y coordinates in the text above.
Question 2:
After I insert the ellipse I want it to be "link" like when I click on it something happens
I also want to display a tooltil when I have the mouse over my ellipse is that possible?
|
|
|
|
|
Why are you using float.parse on ints ? You have one line in each that doesn't have 4 chars, so it seems you should check your array for 4 elements first. That's always wise anyhow.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you for the answear(s)
Now I got it writing on the picturebox and when clicking on ellipse it shows a messagebox
But it only works for the last ellipse because the variable gp changes <.<<br mode="hold" />
Any idea?
Here is the code:
public void readFileToPaint()<br />
<br />
{<br />
<br />
string line;<br />
<br />
string data;<br />
<br />
string fileLocation = @"D:\msbEditor\monstersetbase.txt";<br />
<br />
using (StreamReader sr = new StreamReader(Convert.ToString(@fileLocation)))<br />
<br />
{<br />
<br />
while ((line = sr.ReadLine()) != null)<br />
<br />
{<br />
<br />
<br />
line = line.TrimEnd();<br />
<br />
<br />
if (line == "") continue;<br />
<br />
data = line;
<br />
<br />
String[] piecesMap = data.Split('\t');<br />
<br />
<br />
if (piecesMap.Length == 1) continue;<br />
<br />
Rectangle rect = new Rectangle(Convert.ToInt16(piecesMap[3]), Convert.ToInt16(piecesMap[4]), 4, 4);<br />
<br />
gp.AddEllipse(rect);<br />
<br />
}<br />
<br />
}<br />
<br />
}<br />
<br />
public void pictureBox1_Paint(object sender, PaintEventArgs e)<br />
<br />
{<br />
<br />
Graphics g = e.Graphics;<br />
<br />
g.DrawPath(new Pen(Color.Red), gp);<br />
<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
<br />
{<br />
<br />
readFileToPaint();<br />
<br />
pictureBox1.Paint += new PaintEventHandler(this.pictureBox1_Paint);<br />
<br />
this.Controls.Add(pictureBox1);<br />
<br />
}<br />
<br />
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)<br />
<br />
{<br />
<br />
if (gp.IsVisible(e.X, e.Y))<br />
<br />
{<br />
<br />
MessageBox.Show("");<br />
<br />
}<br />
<br />
}
|
|
|
|
|
You need to keep a list of all the ellipses and iterate over them, instead of just keepin ghte last one
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Any idea of that?
I cant seem to think of a way :x
gp is defined here:
GraphicsPath gp = new GraphicsPath();
|
|
|
|
|
Good evening Everyone
i have the following string in my connection string.
Server=VUYISWA-57F1183\SGICORNETGS01
Now from the above code,the name of the SQL server has a "\" character and C# compiler is Complaining about the Character and the connection string in quotes. How can i enclose it, in a manner that the compiler does not recognise it as a Special character.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hi
there are 2 possibilities to suppress escape-sequences
1.: double backslash:
Server="VUYISWA-57F1183\\SGICORNETGS01";
2.: the @ - sign:
Server = @"VUYISWA-57F1183\SGICORNETGS01";
greets
m@u
|
|
|
|
|