|
Use the CurrentCell property to change which cell is visible (ie, set it to the first column in the last row).
It looks really stupid this way; but here is the code to do that
myGrid.CurrentCell = new DataGridCell(rowIndex, 1);
[rant]
Who ever thought it would make sense to assign a cell to the current cell property must've been smoking something at the time. To me this says replace the contents of the current cell with this new cell. Its not until you look at the documentation for DataGridCell that you realize it is used only to identify a cell by location and not to hold the actual contents of it.
[/rant]
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thanks.
I do agree that it doesn't look "elegant".
I also agree it would seem there is "something" missing, but could just be the 'ol VB6er in me..
|
|
|
|
|
I have a control that overrides WndProc . I handle WM_NCCALCSIZE and in the case where LParam is true I need to store a pointer to a value in the Result field of the Message structure. I do so as follows:
msg.Result = Marshal.AllocHGlobal(4)
Marshal.WriteInt32(msg.Result, WVR_REDRAW)
I never call Marshal.FreeHGlobal since the Result is used outside the scope of WndProc .
Will this code cause a memory leak? If so, is there any way to do this without a memory leak?
Thanks
|
|
|
|
|
msg.Result = WVR_REDRAW;
will be just fine
|
|
|
|
|
That won't compile for me since Result is an IntPtr and WVR_REDRAW is just an Integer ...
|
|
|
|
|
Ok,
msg.Result = new IntPtr(WVR_REDRAW);
As far as I'm concerned you are a lower form of life than B*** S***** and M***** M******** combined. Colin Davies on some guy called R*** G****
|
|
|
|
|
That doesn't work either.. That creates a pointer to memory location WVR_REDRAW, the value at that location is not controlled by me.. I need to set Result to an IntPtr that points to a location containing the value WVR_REDRAW... The only way that I know of to do this is with the AllocHGlobal and WriteInt32 calls...
|
|
|
|
|
Kastro wrote:
That doesn't work either..
No my code was right IntPtr is a value type so you will not have any problems.
You don't need AllocHGlobal
As far as I'm concerned you are a lower form of life than B*** S***** and M***** M******** combined. Colin Davies on some guy called R*** G****
|
|
|
|
|
From the .NET help docs:
public IntPtr(
int value
);
value - A pointer or handle contained in a 32-bit signed integer."
IntPtr is a value type, but the value that it stores is an address.
My original code works (presumably leaking memory though). When I switch to using new IntPtr(WVR_REDRAW) it doesn't work...
|
|
|
|
|
IntPtr is a value type of size same as the default pointer size for the platform. It can be used for numbers or pointers. All it is is that it size varies the number stored in it can be anything.
In window messages LParam, and WParam are 32 bit ints or 64 bit ints depending on the platform. In window messages LParam and WParam mean different things depending on the context. Same thing about LResult it can be used to return integers or pointers. In case of WM_NCCALCSIZE windows expect an integer to be returned so if return as new IntPtr(WVR_REDRAW) it is ok.
|
|
|
|
|
Ok, I figured out what's going on... You are right about just using new IntPtr(WVR_REDRAW).. I used Spy++ to see what result was being returned for the WM_NCCALCSIZE message...
For my code I was getting WVR_ALIGNBOTTOM | WVR_REDRAW | 0019F008
From what you suggested I get WVR_REDRAW...
What you suggested wasn't working (as far as the control went) because of other reasons...
Also is the wording of the help file incorrect then? That's what led me to believe what I did.
|
|
|
|
|
Kastro wrote:
Also is the wording of the help file incorrect then?
Not entirely, IntPtr is used to represent an integer value that varies in size depending on the platform. A specific use of such an integer is a pointer. There isn't anything special about a pointer, except that its value refers to a location in memory.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Hi
I have a problem with running more than 2 async WebRequest's when launched. To explain better. Only 2 at a time responds, while the others wait for a "slot" to open. Then once one "slot" is open, the next async WebRequest will continue.
I am invoking all the requests from a foreach loop in the main program thread. I was thinking there is maybe a 2 operation limit, but can find no such mention.
IAsyncResult res = ds.WebRequest.BeginGetResponse( new AsyncCallback( this.ResponseCallback) , ds);
But ResponseCallback only get called when a slot opens up.
Any help will be accepted.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
This is the behavior of IE; to test it yourself upload 3 largish files to a website and create a webpage linking to them. Load the page up then right click and save target as on 3 of them; 2 will go immediately while the third will wait. I can't remember the agreed upon reasoning for this at the moment.
Unfortunately not much you can do about it unless you create your own class which will do the downloading. But there is a chance such a class already exists
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
Unfortunately not much you can do about it unless you create your own class which will do the downloading.
Thanx James, this is exactly what I am doing
I have tried calling Stream.Read each from its own thread, but with no joy either Now only one download starts and with a second one following that and all others timing out.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
You aren't going to be able to use the WebRequest class at all; because the problem is how the WebRequest class works, by shifting the burden to the IE implementations which has the 2 connections to the same server limit.
The "work around" is to create your own WebRequest type class using the base Socket class to handle the communication with the HTTP server.
Given the TcpClient class this might not be very hard, if you have the HTTP 1.1 spec open since most communication is done via text.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thanx James, I thought it has somethin todo with that , for some reason i believe that number use to be 4, till IE 5/6, then it went back to 2.
James T. Johnson wrote:
2 connections to the same server limit
Is this limit only per server, iow should i get more connections if i have more servers available with the same resource?
Is there not a registry entry that can be modified?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Is there a way to check this? i have been looking through the documentation and found nothing....even i can get the filename, i could tell.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Does anyone know how to get an icon from a DLL and put it in an image list? the icon is in the SHELL32.dll file.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I am overriding the OnMouseDown in a DataGrid to do one simple thing (open a browser window on click.)
However I then naturally loose the other native abilities of the DataGrid such as automatic column sizing and automatic column sorting.
So my question is there no way I can "selectively" override or rather "hook onto" that event to run my own code, but then leave the native abilities of the DataGrid alone?
Or do I basically have to re-write the sodding code for column resizing and sorting?
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
|
|
|
|
|
You should be able to call the base.OnMouseDown() method when you want to let the DataGrid handle the other things (its usually a requirement anyway so the MouseDown event fires)
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
You should be able to call the base.OnMouseDown() method when you want to let the DataGrid handle the other things
Thank you James, that works like a bomb
I am getting a clearer picture of overriding and inheriting now.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
|
|
|
|
|
|
Nishant S wrote:
How can a Windows.Forms derived control's constructor differentiate between designer instantiation and run time instantiation?
LMAO I have exactly that same problem with CP+. Damned constructor loads some files which are obviously not present at design time, so then the Form Designer shows that horrid HRESULT 0x80131019 error. So far I have not found a way to get around it.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
|
|
|
|
|
You could get around this by delaying the loading of the file until the Load event of the UserControl and supplying reasonable default values until then (for the designer).
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|