|
I have the problem with binary data (Ex: image) not the textual data!
Thanks anyway,
Hung.
Hung
|
|
|
|
|
You are right. Sorry.
This is what you need to do:
// Prepare web request...
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://www.noviway.com");
// We use POST ( we can also use GET )
myRequest.Method = "GET";
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse= (HttpWebResponse)myRequest.GetResponse();
// Display the contents of the page to the console.
Stream streamResponse = myHttpWebResponse.GetResponseStream();
MemoryStream memStream = new MemoryStream();
byte[] readBuffer = new byte[256];
// Read from buffer
int count = streamResponse.Read( readBuffer, 0, 256 );
while (count > 0)
{
memStream.Write(readBuffer, 0, count);
// Read from buffer
count = streamResponse.Read( readBuffer, 0, 256);
}
byte[] originalBuffer = memStream.ToArray();
// Release the response object resources.
streamResponse.Close();
// Close response
myHttpWebResponse.Close();
Eran Aharonovich (eran.aharonovich@gmail.com )
Noviway
|
|
|
|
|
Hello
Try this:
HttpWebResponse response = request.GetResponse()
System.IO.Stream responseStream = response.GetResponseStream()
byte[] input = new byte[responseStream.Length];
responseStream.Read(input, 0, (int)responseStream.Length - 1);
Regards
|
|
|
|
|
Although the stream has data, the length of responseStream is -1. This is the main problem I facing !!
Thanks anyway!
Hung.
Hung
|
|
|
|
|
According to the MSDN[^] documentation, Read returns the number of bytes actually read. So you could always create a buffer of some arbitrary size, say 512 bytes, and then loop till Read returns less than 512 bytes. Something like.
ArrayList finalBuffer = new ArrayList();
byte []buffer = new byte[512];
int bytesRead = 0;
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
{
for (int i = 0; i<bytesRead; ++i)
{
finalBuffer.Add(buffer[i]);
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Is there a chance to compile more assemblies to one assembly ?
|
|
|
|
|
Whereas I am no expert on VS, I have noticed that Dotfuscator Pro has such a facility - the CE edition is supplied free with VS. Search the internet for info. If this doesn't help - sorry but my knowledge is so limited that I am unlikely to be able to help further!
Cheers
Pensioner Graham Dean
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Hello
Please be specific or at least post more details on your question. What do you mean by:
dedel wrote: compile more assemblies to one assembly
Regards
|
|
|
|
|
i want to build a DLL from a collection of DLLs
|
|
|
|
|
Sorry!!
Not if you don't have the source code. Without the source all you can do is referencing.
Regards
|
|
|
|
|
Take a look at ILMerge[^]
“Accept that some days you are the pigeon, and some days you are the statue” -- David Brent
Cheers,
Will
|
|
|
|
|
i have form1 do something. the time required to do is about 2 minutes.
i want to display a form(waiting screen) while form1 complete the task.
my idea is that:
before doing the required task,
- create a new thread.
- open the waiting form in the thread.
- start the thread
it works, but you can access the form1 during doing task.
any idea?
|
|
|
|
|
You can make your waiting form modal and show it in the main thread but process a task in a separate thread.
|
|
|
|
|
many thanks, but how close the modal after the process finished
|
|
|
|
|
Keep reference on the waiting form and close it at the end of the working thread:
private WaitForm waitForm;
private delegate void CloseWaitFormDelegate();
private void StartProcess()
{
Thread processThread = new Thread(new ThreadStart(Process));
waitForm = new WaitForm();
processThread.Start();
waitForm.ShowDialog(this);
}
private void Process()
{
CloseWaitFormDelegate closeWaitForm = new CloseWaitFormDelegate(CloseWaitForm);
Invoke(closeWaitForm);
}
private void CloseWaitForm()
{
if (waitForm != null)
{
waitForm.Close();
waitForm = null;
}
}
-- modified at 4:35 Monday 10th July, 2006
|
|
|
|
|
Hello
You can set the Enabled property of your first form to false; then make it true again when you finish your task.
Form1.Enabled = false;
Form1.ShowWaitScreen();
Form1.DoMyWork();
Form1.CloseWaitScreen();
Form1.Enabled = true
Regards
|
|
|
|
|
If you do a search in CodeProject for SplashScreen you will find an example in there of what you need to do.
|
|
|
|
|
Hi guys,
I have a combobox (DropDownStyle = DropDown). This Combobox is loaded with a DataSource and Display- and ValueMember set.
I can set a free text to the combo, but when I try to read it out again, it always reads an item that is part of the datasource.
How can I solve this? Can you add items to your datasource? Is there another way around this? Maybe one of my properties is set incorrect? (although I checked them and they seem ok).
This is the last bug I could find and tomorrow morning I only have about 1 hour to install and bugfix our application so I hope somebody can help me (pleasing my boss and client )
TNX!
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
Hello
V. wrote: it always reads an item that is part of the datasource
I've tried your problem, but it didn't happen at all. Here is my code:
-Assume you have comboBox1 and button1 in your form-
public partial class Form1 : Form
{
ArrayList arr;
public Form1()
{
InitializeComponent();
arr = new ArrayList();
arr.Add("hello");
arr.Add("World");
arr.Add("is");
arr.Add("an");
arr.Add("old");
arr.Add("example");
comboBox1.DataSource = arr;
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.Text);
}
}
When I press button1, it displays the current text just fine. So, where is your problem??
V. wrote: Can you add items to your datasource?
Data source is dealed with through the IList interface. so you can add items as long as you know the type of your list -strings, numbers, etc...-
eg.
((IList)comboBox1.DataSource).Add(comboBox1.Text);
But don't forget to refresh your ComboBox after adding items to the datasource.
Regards
|
|
|
|
|
|
I did it .
It took me some tries to find it, but it seems to work.
tnx a lot !!
DataView view = (DataView)mycombo.DataSource;<br />
DataRow r = view.Table.Rows[0];<br />
r[0] = mytext; <br />
r[1] = -1;<br />
((IList<DataRow>)mycombo.DataSource).Add(r);
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
-i've seen that there're System.IO.Ports for serial port but it only has got in .net framework v2 but i've just got VS.net2003 framework v1.How can i do ?
-will VS.net 2003 be able to use .net framework v2.i downloaded a .net framework v2 and installed it but VS.net 2003 show that .net framework version is 1.1xxx. Why didn't it upgrade to a new version?
|
|
|
|
|
VS 2003 wasn't built to be used with future versions of the framework. You can download express versions of Visual Studio 2005 for free from the Microsoft site, to build applications for framework 2.0. If you are a professional developer you might want to upgrade to the pro version of VS 2005. Try out the Express to see if it fits your needs. You can have VS 2003 and VS 2005 installed side by side without problems.
---
b { font-weight: normal; }
|
|
|
|
|
There are several free RS232 port classes available on the web, one was even provided by Microsoft in their :shudder: Visual Basic .NET Resource Kit :endshudder: a few years back. I don't know if the code is still available, but basically all it does it call the Win32 API, which is all the System.IO.Ports classes do (take a look in reflector at them ).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|