|
You can't shutdown a remote socket by closing your end. Once a connection gets established with the server, the server communicates to the client using a different port. When you shutdown the connection, it is that port that closes down.
In your case, the webserver will keep running. Just think of it, if a webserver shuts down simply because a client closed a connection, it would be unusable..
Regards
Senthil
|
|
|
|
|
Hello,
I need to be able to find the first row where the first eight columns are empty. Right now I just get a cell range, loop through the first eight values, and if I didn't find anyhting, then the row is empty (at least the first eight cols are empty) and I continue to the next row.
Is there a method that already exists that I can use to achieve the same results? It seems inefficient to have to read the first eight values of every row until you find an empty one. If I hae many rows, and the next to last one is empty, it would take a while to find that out.
It would also be ok if I could fid the first totally empty row.
I looked at the UsedRange of the sheet but it includes empty lines in its range.
Thanks for the help,
-Flack
|
|
|
|
|
I know what you mean, I think the UsedRange includes any cell that has formatting, which can be quite annoying.
Try this
Range rng = Sheet1.UsedRange;<br />
object[,] data = null;<br />
data = (object[,])rng.Value;<br />
Marshal.ReleaseComObject(rng);
Looping through the array is much faster then looping through cells.
|
|
|
|
|
Don't know if this will help you, but I'll give it a try. In my VBA makros I use the following code and it works great.
ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
/* Edit
The above code returns the last non-empty row, so you'll have to increase the result by one
*/
www.troschuetz.de
|
|
|
|
|
I have read enough about Alternate Data Streams (ADS) to know that copying files from an NTFS file system to (say) FAT32 will lose them; and I think it may be possible to use one CD-R format (?UDF) and retain them.
Also, I have corresponded with the WinZIP folks and they say that they have occasionally had requests for the ADS to be archivable in their ZIP package, but it's not a large enough number of requests for them to include it as a feature.
I am designing an application that uses ADS to keep extensive metadata (well beyond Custom properties, and moderately large amounts of text and XML) that describe GIS files, and would like to be able to retain the streams on a medium such as CD-R or DVD.
What alternatives do I have to do that?
I would prefer to write something myself using C# or VB.NET - so the useful APIs would be a first step.
Perhaps someone with some experience in programming against the NTFS system and its data streams could give me a few pointers?
Ian Thomas
|
|
|
|
|
First of all, I'm fairly new at programming in C#, so if my question seems rediculously simple, I apologize.
I'm trying to build an application that uses the OldDbConnection (Jet 4.0) to access a Microsoft Access .mdb file. So far, the only way I've found to get it to link up properly is to give it the full path of the database file. This is fine for my system, but I want to be able to package it up and share it. Is there a shorthand path I can give it to indicate that the database file is in the same directory as the executable, or will I need to set up some variable?
If I'm going to have to store the path somewhere, what is the preferred way to do that in .NET?
Again, I realize that some of the questions deal with basics, but I've gotta start somewhere. Any help would be greatly appreciated.
--In a world without fences, who needs Gates?
|
|
|
|
|
Application.StartupPath should give you the executable's path. Check here[^].
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
hello can some one plase help me construct a list in c# that will do this
example on a list
name = new list();
name.myname = "michael hansen";
subname = new list();
subname.myname = "michael son martin";
subname = new list();
subname.myname = "michael sister jane";
just a little example what the list will look like
michael hansen root
---------son martin child
---------sister jane child
claus hansen new root
---------son martin child
---------sister jane child
and so on
i must be in Inode or list or item function in c# it has to be fast
no use of treeview or xml or any part of controls
just plain linked list wiith a like parant and child
plase mail at michaelhansen555@msn.com
if some one have a source code for that kind of list
tanks
best regards
michael hansen
|
|
|
|
|
Use Beta 2.0 System.Collection.Generic
LinkedList<>
Or try To use ArrayList
Dynamic Array.
|
|
|
|
|
|
Hi Everyone,
I have a question, and I really don't know how to make it works. The questio
ns is that I have a LinkButton Column on a DataGrid table.
:
protected System.Web.UI.WebControls.DataGrid dgInfo;
:
dgInfo.Items[j].Cells[1].Text = "MyData";
:
:
After I change the cell text to "MyData", the cell losts the link. Does ther
e have any way to change the LinkButton text to two different texts and keep
the link button attribute?
Thanks a lot ....
|
|
|
|
|
I would like to change the color of the FixedSingle BorderStyle in the PictureBox from Black to Red
How Can i Do it??
C# Winforms
|
|
|
|
|
Why can't the as operator perform user-defined conversions?
Is it a C# problem or with MSIL? I can't see any reasons why the compiler should'nt be able to use a user-defined conversion operator. Anyone knows the answer?
MSDN
my c# blog: C# Coach
|
|
|
|
|
I am confused... you never need to do that. Perhaps you are looking for explicit casting, but that will only work as reference type. Btw, have u looked at the output of an as expression in MSIL? That will show you the what actually happens when it is used.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Hi Everyone,
I have a question, and I really don't know how to make it works. The questions is that I have a LinkButton Column on a DataGrid table.
:
protected System.Web.UI.WebControls.DataGrid dgInfo;
:
dgInfo.Items[j].Cells[1].Text = "MyData";
:
:
After I change the cell text to "MyData", the cell losts the link. Does there have any way to change the LinkButton text to two different texts and keep the link button attribute?
Thanks a lot ....
|
|
|
|
|
I am creating a C# wrapper for a FORTRAN app. There are several cases where I have the FORTRAN writing to standard output and reading from standard input. I have seen several examples of how to redirect standard IO when you spawn a new process, but I want to know how to do something similar when you make calls to methods within a DLL.
<br />
[DllImport(@"waypoint.dll", EntryPoint="MAKETHIS")]<br />
public static extern void MAKETHIS(StringBuilder output);<br />
That's how i'm accessing the function within the DLL.
The reason why I don't just return a simple value is that the process takes over 2 minutes to complete (CPU intensive) so I want to read the status as the FORTRAN runs. The FORTRAN is outputting something like:
15 jobs done
30 jobs done
42 jobs done
48 jobs done
...
And so I want to catch this ouput from my C# wrapper.
I'm using Intel Visual Fortran (if that matters).
Thanks in advance for any input. :->
|
|
|
|
|
|
I've made some progress... I've been able to redirect the standard output to a text file using something like
<br />
[ DllImport( "Kernel32.dll" )] br />
internal static extern bool SetStdHandle( int nStdHandle, HandleRef hndRef); <br />
Then I assign a text file handle as follows:
<br />
FileStream fs = new FileStream( "output.txt", FileMode.Open );<br />
HandleRef hr = new HandleRef( fs, fs.Handle );<br />
<br />
uint STD_OUTPUT_HANDLE = 0xfffffff5;<br />
SetStdHandle((int) STD_OUTPUT_HANDLE, hr);<br />
I think I'm pretty close... now I want to somehow setup an arbitrary handle to ???? so that the output stays in memory and I can read it be redirecting standard input or something. Any ideas?
I REALLY want to try to avoid launching other processes just for what should be just a simple method call.
|
|
|
|
|
Larsenal wrote:
HandleRef hr = new HandleRef( fs, fs.Handle );
That will get you nowhere, its not the same thing. Why not write the output of the Fortran dll to a file instead of stdout? or create a callback in the fortran function to report progress. That you can use in C#.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
leppie wrote:
That will get you nowhere
Really? It actually redirects the stdout to the file as expected. I do not want to write to a file because I need to be able to read the output continuously from another thread. I am afraid I will run into problems with synchronization. Remember, the FORTRAN is doing a lengthy calculation and it spits its progress out to STDOUT. I want to just read that progress as it comes.
Are you suggesting opening, appending, and closing the file every time one more line of my progress becomes availalbe and then open, read and close the file from C# to check if there is any progress? Seems like a bad solution. Is there anything more elegant?
|
|
|
|
|
Anonymous wrote:
Seems like a bad solution.
The bad solution is printing to stdout from a dll.
Anonymous wrote:
Are you suggesting opening, appending, and closing the file every time one more line of my progress becomes availalbe and then open, read and close the file from C# to check if there is any progress?
Yes thats probably not good, but your example made me think thats what u are doing...
Going with a callback solution would be best, IMO.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
leppie wrote:
The bad solution is printing to stdout from a dll.
I agree... however, I don't have control over rewriting the DLL.
|
|
|
|
|
Hello,
With the Win32 API I could get a handle to the system icons by calling LoadIcon with a NULL instance handle (eg. hIcon = LoadIcon(NULL, IDI_HAND) ).
How can I get the system stop icon in totally managed way? (without P/Invoke)
[EDIT: And if I require P/Invoke, what's the equivalent of MAKEINTRESOURCE ?]
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Sorry about the vote of 1. I wasn't thinking and clicked the wrong link.
For questions like this you really should consult the header. If you look at the definition for the MAKEINTRESOURCE in Winuser.h (which is documented as the header in which it's declared in the Platform SDK documentation), you'd see:
#define MAKEINTRESOURCEA(i) (LPSTR)((ULONG_PTR)((WORD)(i)))
#define MAKEINTRESOURCEW(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
#ifdef UNICODE
#define MAKEINTRESOURCE MAKEINTRESOURCEW
#else
#define MAKEINTRESOURCE MAKEINTRESOURCEA
#endif // !UNICODE What's going on here? Well, certain APIs like LoadIcon want a string, and since an integer isn't a string you need to pack the integer into a string which the API will handle.
To declare a similar macro (or, rather, a method) in C# isn't nearly as straight forward, since a short (same as a WORD ) isn't a string.
To get around this, declare LoadIcon like the following in order to pass a parameter of the correct size (size of a pointer):
[DllImport("user32.dll", SetLastError=true)]
static extern IntPtr LoadIcon(IntPtr hInstance, IntPtr lpIconName);
public IntPtr LoadIcon(short id)
{
IntPtr i new IntPtr((int)id);
return LoadIcon(hInstance, i);
} If you need to overload LoadIcon to pass a string you can still do that. SendMessage , for example, is overloaded many different ways in the .NET BCL assemblies where it's used. So long as the parameter size is still the same (which is why you simply can't overload it and pass a short ) you're fine, so long as the right data is passed as that parameter.
Once you have the IntPtr return you can use Bitmap.FromHicon to load the icon into memory.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
Sorry about the vote of 1. I wasn't thinking and clicked the wrong link.
Don't worry!
Thanks, I got it working with P/Invoke. But I wish there were a a managed way of doing it.
Thanks!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|