|
We found that WebClient.DownloadFile or HttpWebRequest and HttpWebResponse
has problems when the user is using proxy. we tried
using proxy class to supply relevent
information that also did not work.
Further the download seemed faster with
the extra library since it downloaded
parts of the file (using threads) and joined them later.
we dint have any problems with the proxy also.
Does the BCL classes also implement the
same?
cool man
|
|
|
|
|
I don't remember off the top of my head, but I believe that was fixed in .NET 1.0 SP2. I know it's not in the list of fixes for .NET 1.0 SP3 & .NET 1.1 SP1 (I got on this team at the time of their release).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
How to trim unnecessary white space whith in two strings using regular expressions?
|
|
|
|
|
Try the following:
string sentence = "Hello my name is Nick.";
string text = Regex.Replace(sentence, "\\s+", "");
Console.WriteLine(text);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi friends,
I am trying to copy stream of chars from file to buffer(char[]) by following code :
char[] cbufferi = new char[2000];
FileStream f=new FileStream
("test.dbf",FileMode.Open,FileAccess.Read);
BinaryReader br = new BinaryReader(f);
cbufferi = br.ReadChars(2000);
BUT method br.ReadChars(2000) reads only ASCII chars and it neglects NON-ASCII (char with value>127) and hence data stored in cbufferi is inaccurate. I am trying to read header of DBF files and then I want to further process header afterwards. Please let me know how can I read header of file so that it contains ACCURATE data ie. ASCII/NON-ASCII data.
Thanks for your help..
|
|
|
|
|
Did you try this:
<br />
byte[] buffer = new byte[2000];<br />
f.Read(buffer, 0, 2000);<br />
char cbuffer = Encoding.Default.GetChars(buffer);<br />
|
|
|
|
|
Hi John,
Hey Great... this worked. Thank you very very much for the help.
|
|
|
|
|
hi,
How can i cast datasource of a datagrid to a datatable.
I tried this block for that. But no result
DataTable dt=((DataTable)this.MicroGrid.DataSource) as DataTable;
Do u have any idea ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Actually, the code should be:
DataTable dt = (DataTable)MicroGrid.DataSource;
You might want to check the type of the DataSource before you attempt to cast it to a DataTable. Not all DataSource s can be cast to a DataTable ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
Did you checked whether your answer is good enough to serve my purpose ?
Dear it is not working and i am getting a an error " specified cast is not valid ".
code block :
MicroGrid.Datasource=dataset.Table["xyz"].DefaultView;
DataTable dt = (DataTable)MicroGrid.DataSource;
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
Did you checked whether your answer is good enough to serve my purpose ?
$#@*^@$$... Like I told you in my previous post. CHECK THE TYPE of DataSource before you try and cast it to a DataTable. Your DataSource is bound to a DataVIEW, not a table. You can't cast a DataView to a DataTable, so therefore, yes, "The specified cast is not valid."
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
My old post is a sample senario that i shown to you.
DataTable dt = (DataTable)MicroGrid.DataSource;
this also not working.
In my application, using a data adapter i am filling "Employee Table Data" into a dataset and store it in "EMP" table.
Adapter.fill(Dset,"EMP");
After this, i set the datasource of my grid(MicroGrid) to Dset.Tables["EMP"];
MicroGrid.Datasource=Dset.Tables["EMP"];
Then i tried this below mentioned lines of code
DataTable Dt=(DataTable)MicroGrid.Datasource
Still i am getting same error ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi everybody,
How do I programmatically minimise and hide the console window in C# .NET ?
It is a console application.
Any help will be greatly appreciated.
Thanx in advance
saleem
|
|
|
|
|
One possible way would be through the use of the Win32 function FindWindow which will give you the HWND or Handle to the command window. Once you have the HWND you can call ShowWindow passing SW_MINIMIZE as the nCmdShow parameter. That should get you started.
[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
const UInt32 SW_HIDE = 0 ;
const UInt32 SW_SHOWNORMAL = 1 ;
const UInt32 SW_NORMAL = 1 ;
const UInt32 SW_SHOWMINIMIZED = 2 ;
const UInt32 SW_SHOWMAXIMIZED = 3 ;
const UInt32 SW_MAXIMIZE = 3 ;
const UInt32 SW_SHOWNOACTIVATE = 4 ;
const UInt32 SW_SHOW = 5 ;
const UInt32 SW_MINIMIZE = 6 ;
const UInt32 SW_SHOWMINNOACTIVE = 7 ;
const UInt32 SW_SHOWNA = 8 ;
const UInt32 SW_RESTORE = 9 ;
const UInt32 SW_SHOWDEFAULT = 10 ;
const UInt32 SW_FORCEMINIMIZE = 11 ;
const UInt32 SW_MAX = 11 ;
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi.
I want to access to all object on the form like sqlDataAdapters,DataSets and ... .
(Form.Controls not contain the sqlDataAccess like objects)
|
|
|
|
|
The Non-Controls are instance variables. You can get all variables with System.Reflection:
<br />
FieldInfo[] arrInfo = form.GetType().GetFields();<br />
foreach(FieldInfo info in arrInfo){<br />
Console.WriteLine(info.Name + " - " + info.GetValue(form));<br />
}<br />
|
|
|
|
|
hi,
Corinna John Wrote
The Non-Controls are instance variables
i have a small doubt.
see the line below
TextBox txt=new TextBox();
txt.Name="sadas";
this.Controls.Add(txt);
so this "txt" instance fall in which section non-control section or control section. And "txt" of which type ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
There is one instance of the TextBox class. You can't access objects directly, you need a variable of the object's type to reference the object.
The first variable is txt . It's a local variable in your example.
Controls.Add(txt) copies the variable, but not the object. That means, you have one object with two references. The first reference is still txt , the second one is the new item in the Controls collection.
If you use the Forms Designer to drag a new component onto a form, it generates code for an instance variable private TextBox txt , and more code to create the object new TextBox() . the variable txt is an instance variable of the form, referencing the TextBox. And there's an additional reference the the TextBox in the Controls collection.
|
|
|
|
|
thank you.
I use this approach, but i can not obtain my desired object and change its value .
for example i want to get an sqlDataAdapter object and change one of its properties.
please guide to me.
|
|
|
|
|
Is your object not in the array? Then maybe you have to use different BindingFlags:
<br />
fields = form.GetType().GetFields( BindingFlags.NonPublic | BindingFlags.Instance );<br />
if( info.GetValue(form) is SqlDataAdapter ){<br />
}<br />
|
|
|
|
|
|
hi,
TehMedic Wrote :
Form.Controls not contain the sqlDataAccess like objects
You mean controls are not object of their base ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I think he means all the visual components he dragged onto the form in the VS Designer.
The Designer creates instance variables for the components, and displays a little box for each one. No matter if you drag a control or another icon onto the form, the Designer always creates an instance variable und writes code to create and initialize the object.
The controls can be found later on in the form's Controls collection, just like any other control. But there's no collection for the non-controls, they are nothing but instance fields that are initialized in InitializeComponent.
|
|
|
|
|
Hello All
I'm working in a LAN monitoring software one of it's feature is to shut down it's clients. Can anybody guide me which classes to explore to shut down a remote pc form ur C# Applcation. I'll be thankfuk for ur guidance.
God bless
Riz
|
|
|
|
|
Hello jinn_baba,
I do not know if there are any native .NET class library functions that you can use to perform remote machine shutdowns. However, you certainly can use the native Win32 APIs to do the job.
The main API is InitiateSystemShutdown(). You would also need to adjust your pvivileges to have the SE_REMOTE_SHUTDOWN_NAME privilege. For this would would need the following APIs :
OpenProcessToken()
LookupPrivilegeValue()
AdjustTokenPrivileges().
Regards,
Bio.
|
|
|
|