|
There are a few articles here on CodeProject that simplifies this for you.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
it depends alot on what environment you are working in.
If you're saving changes to a DB for instance you're going to need to roll back the changes in reverse order taking account of what other users might have done to effect the state of the DB in the meantime.
If you are drawing a poly line and you store the points in an ordered list then removing them one at a time from the end will achieve an undo.
If your application communicates using messages and you can find an inverse for all of those messages then you could store the messages in a list and a pointer to the current position. Redo moves the pointer up one, adding something new deletes everything after in the list etc ect.
Your object could store a collection of serialised versions of itself and each time you change the object you serialise it into its own internal store (hint: mark the collection so that it doesn't get serialised) This might be nice as you could add this functionality to an UndoRedoBase but could potentially use alot of memory.
my 2p
Russ
|
|
|
|
|
Hi guys,
I'm trying to access an SMB share hosted on an AS400 server. The server is nothing to do with the domain security. My windows server needs to periodically access this folder and read/write to some files.
The access security is managed by the server. The path is: "\\qfgmas400\STX\mvx_desp". If i try something like:
DirectoryInfo fi = new DirectoryInfo(@"\\qfgmas400\STX\mvx_desp");
FileInfo[] fia = fi.GetFiles();
I get an UnauthorizedAccessException.
Any ideas how i can pass a username and a password to connect to the share?
Cheers
Will
|
|
|
|
|
I retrevied the Images from Database And Display In datalist.
I used Two Buttons(prev and Next).
Here I place one image control at the top.
At Bottom In datalist All the Images is displaying.
At first in that image control first image will be displaying.
if we click next button then next image will be displayed.
if we click previous button then previous image will be displayed.
Here this buttons is not working.please Send the code In Detail Immediatly.
Its Urgent.
thanks and regards
cwah
|
|
|
|
|
Just use the BindingNavigator control. I did it for the first time today, and it took all of 5 minutes.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
I retrevied the Images from Database And Display In datalist.
I used Two Buttons(prev and Next).
Here I place one image control at the top.
At Bottom In datalist All the Images is displaying.
At first in that image control first image will be displaying.
if we click next button then next image will be displayed.
if we click previous button then previous image will be displayed.
Here this buttons is not working.please Send the code In Detail Immediatly.
Its Urgent.
thanks and regards
cwah
|
|
|
|
|
How do i create a desktop application in c#.net on automobile industry?
|
|
|
|
|
Have you tried Microsoft Robotics?
|
|
|
|
|
no wat is Microsoft Robotics?
Plz do tell me
|
|
|
|
|
|
Same answer as to other people who want to know how to build something against a particular area,
1. Get the user requirements.
2. Design the system.
3. Code and test it.
4. Get others to test it.
5. Release it.
I think that pretty comprehensively covers it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
So far I needed to put a MemoryStream's content to a byte array two times, but in each case MemoryStream.Read() gave back corrupt data.
In the first case I saved an image into a stream then used Read() to put it into a byte[]. When I used Write() to get back a stream from the byte[], the stream was corrupt and I couldn't create an Image from the stream.
The second time I used Read() I tried to put a serialized object into a byte[] and return it to the client with remoting as a return parameter. This time when I used Write() to get back a stream I, BinaryFormatter.Deserialize() threw an error about how the binary stream's header was corrupt (or something like that).
In both cases using MemoryStream.ToArray() instead of MemoryStream.Write() worked as expected, creating a correct byte[].
Both methods use InternalBlockCopy but I'm not familiar with that external function.
I'm just curious if you met the same problem and if you know what causes it.
|
|
|
|
|
After writing, you have to reset the file position before reading the data.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Guffa wrote: After writing, you have to reset the file position before reading the data.
Before deserializing if I don't reset the position I get another error: "End of Stream encountered before parsing was completed.". If I reset the position, then the error is: "Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization."
|
|
|
|
|
You probably made the same mistake earlier
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
I just wanted to show that an error caused by not resetting the position is different from the error caused by using MemoryStream.Read() to fill the byte array. I knew I had to reset the position even before I made my first post. The situation was the same when I used Image.Save().
|
|
|
|
|
Ok, that's the only problem that I can think of. If you want anything more specific than a guess, you have to show the specific code that you are using.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi,
How can i create custom control like fontdialog, colordialog. I mean I dont want to inherite from them, i just want to drag them in form and it will come at the bottom area and i can use them , e.g : ColorDialog Control, when we drag into form its come to bottom area of form and we can use the property. I want to create such type control .
Please Give me some idea !!!
Thanks in Advance
|
|
|
|
|
Inherit from a Component... This will make your object appear in the bottom area in stead of on your form...
|
|
|
|
|
Thanks a lot. 5 from me.
Thanks
|
|
|
|
|
Hi, Can you help me once more...
while i am changing the icon of control using
[System.Drawing.ToolboxBitmap("vdir.ico")]
toolbox icon get changed , while draggin the icon on form , its appering a as defult icon in the bottom,
please help me
Thanks in Advance !!!
|
|
|
|
|
Hey,
does somebody know, if it is possible to host Powershell within c# and authenticate as administrator. Hosting Powershell is not the problem, but the thing with the authentication
Situation:
I need to write an application for Managing Exchange (ExchangeSnap in works fine) an DNS. To get this done I decided to use powershell instead of (psexec.... etc.) My Problem now is that if the user is not an administrator he should enter his admin credentials so that he can use f.ex. dnscmd over powershell.
I hope somebody can help, because i stuck in this .....
Thanks a lot
|
|
|
|
|
Hi,
I have developed a application in which the user will be given the freedom to drag and drop labels and pictureboxes so the whole process is done on a canvas(form) now before starting the actual work i want user to decide the dimensions of the form so i placed two text boxes and a button so whenever the user enters the dimensions and click the button the form of same size is displayed my problem is that this functionality is working with the pixel size i want the user to enter the values in inches if anyone knows how to do this please let me know
regards
sindhu tiwari
its me sid
|
|
|
|
|
Hi,
I have a question. I believe that back in the day API's where used by C++ ect. I also believe that API's are unmanaged code and C# uses managed code by way of Assemblies.
Can someone please tell me if it's possible to use API's in a C# app or point me to a good website where I can read up on it?
ThankS!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
You can use APIs in C# no problem. Suppose that you want to get the hotspot information out of an icon using the API, you would do this:
public class MySampleApiWrapper
{
[StructLayout(LayoutKind.Sequential)]
public struct ICONINFO
{
public bool bIcon;
public int xHotspot;
public int yHotspot;
public IntPtr hbmMask;
public IntPtr hbmColour;
}
[DllImport("user32.dll", EntryPoint = "GetIconInfo")]
public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo);
}. To get this information, you would use
ICONINFO iconInfo = null;
if (GetIconInfo(icon.Handle, out iconInfo))
{
Trace.WriteLine(iconInfo.xHotspot);
} For details on some of the API calls and there signatures, you can use this[^] site.
Deja View - the feeling that you've seen this post before.
|
|
|
|