|
Hey,
Could someone please point me into the right direction as to what I'd need to use in order to retrieve the size of a file on the web, without downloading the whole thing.
Thanks
|
|
|
|
|
You won't know unless you try to download the thing. There's nothing in the HTTP spec that allows for this.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Try inspecting the ContentLength when you using WebRequest and see if it helps.
|
|
|
|
|
Well I solved my own problem with some help from google.
If anyone was wondering on how you do this - I achieved it with the following code:
WebClient client = new WebClient();
client.OpenRead("http://www.website-here.com/");
string fileSize = client.ResponseHeaders.Get("Content-Length");
That's about it.
|
|
|
|
|
Hi all,
I'm new to C# and currently writing an application for a Windows Mobile 5.0 device using the WebBrowser Control. Now, I'd like my application to process some hyperlinks, instead of the WebBrowser sending a request to the webserver.
There is a possibility to call back a method from within an HTML document (by defining an onclick event in a hyperlink: onclick="window.external.TestMethod('teststring')"). But this does not seem to be supported by WM 5.0 (I can't find the ObjectForScriptingProperty I would have to set, for instance), or am I mistaken?
Is there any alternative way to intercept a click on a hyperlink, some kind of work around? I'm grateful for any kind of help.
Thanks in advance.
Mary
|
|
|
|
|
|
That is excactly what I was looking for. Thanks a lot!
|
|
|
|
|
Does anybody know, how the System.Reflection.Emit.EventBuilder works? How can I define a simple event with it?
|
|
|
|
|
|
I haven't any problem with Emit technology, excepting EventBuilder class.
It's simple to create an "event" as ilasm does (using delegate field, public methods add_* and remove_*)... but it isn't an event(Type.GetEvent(...) returns null)!
EventBuilder perfoms three interesting methods - SetAddOnMethod, SetRemoveOnMethod and SetRaiseMethod.
And... what's the methods body should be? ILasm way? If yes, how can I get a delegate field for EventBuilder based event?
|
|
|
|
|
Hi all,
Are there any controls in C# that can be used as a standard old StringGrid? The DataGrid looks nice and all but it seems to require a DataSource and I'm not using one.
Basically, I just need a way of visually representing a two dimensional string array. OK, maybe not just representing, I need for the user to be able to edit fields in this grid during run time.
Any suggestions?
|
|
|
|
|
why not create a 2 column array and allow the user to edit it and then apply it as a data source to the grid?
Pakistani Memon
Prime Minister
Post Meridian
|
|
|
|
|
Sounds good, but how do I apply a 2D array as a data source to a datagrid?
|
|
|
|
|
you have two choice
either you create a 2-column data table
or
create a class with two properties and use the collection as an object data source to the data grid
Pakistani Memon
Prime Minister
Post Meridian
|
|
|
|
|
Sir/madam,
I wanted to know the basic difference between internal and internal protected .As i know both are accessible with in the drive class. and both are accessible under the object of their class.Both are accessible with in the assembly.
So my question is what is the basic bifference between them.
Thanks and regards
pankaj garg
|
|
|
|
|
amaneet wrote: I wanted to know the basic difference between internal and internal protected
internal means accessible only to other classes within the assembly.
internal protected means accessible only to derived classes within the assembly. No other classes (even within the assembly) can access something marked as internal protected .
|
|
|
|
|
Colin Angus Mackay wrote: internal protected means accessible only to derived classes within the assembly.
You sure about that? MSDN says[^] that internal protected grants access to classes that are within the same assembly or derived from the base class (even in external assemblies).
|
|
|
|
|
Vega02 wrote: internal protected grants access to classes that are within the same assembly or derived from the base class (even in external assemblies).
Oops! You're right. I must have misread that and thought that both conditions had to be satisfied. I stand corrected.
|
|
|
|
|
Hi!
i want to open different windows form on clicking differnt nodes. I am using node.tag property for giving url but in url i have to write like this:
node.Tag="C:\\Documents and Settings\\MyDocuments\\Visual Studio Projects\\WindowsApplication1\\General.cs";
and then after that i double click the tree view for getting its after_select event and in that event i write
System.Diagnostics.ProcessStartInfo iexploreStartInfo = new System.Diagnostics.ProcessStartInfo("iexplore.exe", e.Node.Tag.ToString());
System.Diagnostics.Process iexplore =
System.Diagnostics.Process.Start(iexploreStartInfo);
now when i click node the same page opens in the browser thats link is given in tag property but as i wrote general.cs in url the cs file opens. But i want to open that particular form and i m not getting how to do that. Can anybody help me in that problem.
Thanx
|
|
|
|
|
EEmaan wrote: now when i click node the same page opens in the browser thats link is given in tag property but as i wrote general.cs in url the cs file opens. But i want to open that particular form and i m not getting how to do that. Can anybody help me in that problem.
I'm sorry , your not clear at all. By Form do you mean the Form code thats in the General.cs file!? thats a little odd, you would have to compile the .cs file and then run the .exe! But why would you want to do that!??
Gideon
|
|
|
|
|
Hi all,
My application needs to upload an excel sheet into SQl server Databse using c#.
i written code like this.
OleDbConnection DbConn = new OleDbConnection"provider=Microsoft.Jet.OLEDB.4.0; data source='" + System.IO.Path.GetFullPath(File1.PostedFile.FileName) + " '; " + "Extended Properties=Excel 8.0;");
DbConn.Open();
OleDbCommand comm1 = new OleDbCommand();
comm1=DbConn.CreateCommand();
comm1.CommandText="SELECT * FROM [sheet1$]";
OleDbDataReader OldAdap;
OldAdap=comm1.ExecuteReader();
// File1 is an HTML input type=file.
and i am reding data. The problem here is, it is working fine when i run it on local machine(I am reading the excell sheet & contents are uploaded into SQL database). when i deploye it on the server it is giving an error
Failure creating file.
Please tell me the solution & what should i do to read the excel sheet.
Tahnks & Regards
S.Rajeshwar Reddy
|
|
|
|
|
Try out this......................
// Connection String.
String connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + FilePath + ";Extended Properties=Excel 8.0;";
// Create connection object by using the preceding connection string.
con = new OleDbConnection(connString);
// Open connection with the database.
con.Open();
// Get the data table containg the schema guid.
dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if(dt == null)
{
return null;
}
string[] excelSheets = new String[dt.Rows.Count];
int i = 0;
// Add the sheet name to the string array.
foreach(DataRow row in dt.Rows)
{
excelSheets[i] = row["TABLE_NAME"].ToString();
i++;
if(i==sheetNumber)
break;
}
OleDbCommand excelCommand = new OleDbCommand("Select * from ["+excelSheets[sheetNumber-1]+"]",con);
OleDbDataAdapter excelAdapter = new OleDbDataAdapter(excelCommand);
System.Data.DataTable importStudentsDT = new System.Data.DataTable();
excelAdapter.Fill(importStudentsDT);
return importStudentsDT;
My small attempt...
|
|
|
|
|
Hi all,
i have developed an windows application where in which, i want the current path where the project dll is residing,
i mean, here I'm refering to an XML file in the user control like(@"..\\..\xmlfile.xml"); but this path is taking to the application path[Two Up] --after i built this application to an .exe and excute its giving FileNotFound Excpetion.so,
i want the current path where the dll is residing,
Please help me.
Prashanth
|
|
|
|
|
private string CurrentPath = Environment.CurrentDirectory.ToString();
But watch out when using FileDialoges, it can give you the directory of the file/directory you choose.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Take a look at the Application.StartupPath property.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|