|
hi
i have a MdiForm which loads a child form on startup and displays the form to the right side. now when i resize the Mdi Form. i want the child form to maintain its right most position to the mdiform.
whatis happening is as soon as i am resizing the right border of the mdiform.....the child form remain in the current position and hence is not right aligned.
the right property of the form is read only....
how do i come to know how much i need to shift the child form to the right or left of the mdi form...depending on the resize?????
please help?
prash
|
|
|
|
|
In your resize code
childForm.Left = Width - childForm.Width;
This can be computed easily with basic algebra when you know that childForm.Right = childForm.Left + childForm.Width
James
Simplicity Rules!
|
|
|
|
|
Hi,
I've been toying with "web services" lately in both C# and VB6. However, I'm wondering. When I create a web service with C# and I expose my methods as web methods I'm wondering where my methods are runninig ???
I don't see the class in Component Services(MTS) or anywhere. Am I missing something here? Wheres my middle tier ?
Thks in advance ..
Dato ..
|
|
|
|
|
In a .NET XML Web Service the code is running under the context of ASP.NET.
HTH,
James
Simplicity Rules!
|
|
|
|
|
Hello,
can i draw a chart with C# in a way other than the draw line and draw rectangle code???does the C# has classes that helps in drawing charts.
thanx
|
|
|
|
|
Don't think there is anything to help you with chart drawing, except textured brushes.
James
Simplicity Rules!
|
|
|
|
|
You might want to see if there is some way that you can instantiate an Excel object, this can be done very easily in other languages and could give you access to quite a lot of power as far as charting goes.
Nick Parker
|
|
|
|
|
I want to develop an asp.net application but I cannot connect to localhost.Is there any posibility that i connect to a server without having IIS running in background?
|
|
|
|
|
By definition you need a Web server in order to use localhost. Therefore, the answer is "no".
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
|
You're welcome.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Take a look at the following c# code and test it:
using System;
using System.IO;
using System.Net;
using System.Text;
namespace csharp_station.howto
{
///
/// Fetches a Web Page
///
class WebFetch
{
static void Main(string[] args)
{
byte[] buf = new byte[8192];
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http:\\www.csharp-station.com");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
int count = resStream.Read(buf, 0, buf.Length);
Console.WriteLine(Encoding.ASCII.GetString(buf, 0, buf.Length));
resStream.Close();
}
}
}
I expected that the output to be the entire content of Html page that i have requested , but unfortunetlly it returns only little pieces of the Html code.
I would be thankfull to anyone who helps me to fix this
problem
|
|
|
|
|
I'm not sure I understand your problem. When I run it I get the 8k of info you requested.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Please request 100k instead of 8K
and then look at the structure of that Html(it's chonk)
Thank you
|
|
|
|
|
Try this instead...
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http:\\www.csharp-station.com");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
byte[] buf = new byte[1000];
while (true)
{
int bytesRead = resStream.Read(buf, 0, buf.Length);
if (bytesRead == 0)
break;
Console.WriteLine(Encoding.ASCII.GetString(buf, 0, bytesRead));
}
resStream.Close();
Console.ReadLine();
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
I don't have a compiler with me right now!
But I thought that was something like that inside the while loop
bytesRead = resStream.Read(buf, bytesRead, buf.Length-bytesRead);
|
|
|
|
|
For standard file or memory streams you could determine the length of the stream and in a loop read until that many bytes are read. However, seek methods are not supported for the type of stream returned from GetResponseStream. I'm not saying my way is the only way, but when you do get to a compiler, I think you'll find it works
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Thanks Tom,
My confusion is when the Read function is call the second time. Will you lose the info that was already in buf? or is going to attached it at the end of the buf instead of buf[0]?
Again, thanks!
Al
|
|
|
|
|
Albert Pascual wrote:
My confusion is when the Read function is call the second time. Will you lose the info that was already in buf? or is going to attached it at the end of the buf instead of buf[0]?
Yes, I'm writing into the same buf byte array each time through the loop. That's why the WriteLine is in the loop; to print the information on the screen before it gets overwritten with the next block of read data.
Albert Pascual wrote:
Again, thanks!
No problem
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
My fault, my fault!
I always return the big buffer!!
what a mistake! I am sorry I actually didn't read past the Read() function!
My apologies for wasting your time
Al
|
|
|
|
|
No worries, mate
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
It works.Thanck you very much Tom!
|
|
|
|
|
You're very welcome.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
Hi,
I'm having an issue wrapping a particular function from an API. The function looks like:
bool GetPacket(LPADAPTER ad, LPPACKET pack, bool s)
LPADAPTER and LPPACKET are pointers to structures. What I did in C#:
[DllImport("Packet.dll")]
internal extern static bool GetPacket (ref ADAPTER a, ref PACKET p, bool s);
I allways get false in return. I think its a problem with the pointer to structure, but I'm not sure. Any ideas???
The structures have both 4 fields (2 pointers (IntPtr) and 2 uints).
Thanks,
G
|
|
|
|
|
What's the declaration on Packet.dll for that function?
You always can add a breakpoint an debug unmanaged code!
Al
|
|
|
|