|
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?![Mad | :mad:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_mad.gif)
|
|
|
|
|
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
![Poke tongue | ;-P](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_tongue.gif)
|
|
|
|
|
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);
![Confused | :confused:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
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 ![Blush | :O](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_redface.gif)
|
|
|
|
|
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
|
|
|
|
|
The declaration in the API dll is:
____________________________________________________________________
BOOLEAN PacketReceivePacket(LPADAPTER a, LPPACKET p, bool S);
// LPADAPTER is a pointer to an ADAPTER struct
// LPPACKET is a pointer to a PACKET struct
____________________________________________________________________
public struct ADAPTER{ IntPtr handle;
uint SymbolicLink;
uint NumWrites;
IntPtr ReadEvent;}
public struct PACKET{ IntPtr hEvent;
public IntPtr Buffer;
public uint Length;
public IntPtr Next;
public uint BytesReceived;
bool IoComplete;}
____________________________________________________________________
This is what i do in C#:
____________________________________________________________________
//initialize adapter and packet, etc. This works fine (functions return true)
//then:
bool b = false;
IntPtr pp = PacketAPI.PacketAllocatePacket();
PacketAPI.PACKET P =
(PacketAPI.PACKET)Marshal.PtrToStructure(pp,typeof(PacketAPI.PACKET));
byte [] BB = new byte[256000];
IntPtr ptBuf = Marshal.UnsafeAddrOfPinnedArrayElement(BB,0);
P.Buffer = Marshal.UnsafeAddrOfPinnedArrayElement(BB,0);
P.Length = 256000;
b = PacketAPI.PacketReceivePacket(ref A,ref P,false); //Always false
____________________________________________________________________
Thanks for your help,
G
|
|
|
|
|
I am trying to implement a text editable, autocomplete combobox by deriving from ComboBox class and overiding OnKeyPress().
However I can't fix this bug, whenever text is typed into combobox, the mouse disappears, and doesn't show even when the mouse is moved. In fact, it's like the mouse is hiding behind the form window, because whenever it enters the form, the pointer disappears.
Anyone, please help, thanks...
lester
|
|
|
|
|
This may sound very elementary to some. Please forgive me for the ****STUPID**** question.
In VB CHAR () returns the ASCII value. Is there anything similiar to CHAR( ) in c-sharp? Actually I would like test for STX and ETX in a string.
Thank you.
![Confused | :confused:](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
I know that in C++ a char IS the ASCII value.
(2b || !2b)
|
|
|
|