|
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
|
|
|
|
|
I'm attempting to write a fairly complex data structure.
One part of the complexity is that all 8 data operations it supports delegate some code to virtual method.
This is by design because I want the user to subclass the data structure and be able to prevent changes to happen. and / or I want to notify observers.
The unfortunate side effect is: it seems there are no simple way to have all user code run at the begining or at the end of the code.
Hence some user code might be called in the middle of an operation and cause an unrecoverable error. (i.e. corrupt the data structure).
Do you think it's acceptable?
I am thinking there are 2 possibilities:
1. it's ok. Warn the user (in the documentation), these are critical data method, mess them, mess the data!
2. data structure should be fool proof, stack all user change in a class for this purpose and run them at the end
what do you think?
|
|
|
|
|
You can use next template in your structure to recover your data when user code throws exception:
public void SomeOperation()
{
try
{
SomeOperationBase();
}
catch(Exception)
{
throw;
}
}
protected virtual void SomeOperationBase()
{
}
Notice!
1. SomeOperation() is public and nonvirtual.
2. SomeOperationBase() is protected and virtual.
You can also use this template to solve this problem:
The unfortunate side effect is: it seems there are no simple way to have all user code run at the begining or at the end of the code.
-- modified at 4:51 Sunday 9th July, 2006
|
|
|
|