|
Basically values from the database that has been stored into a hashtable... this hashtable will then later be inserted into a cache... i have tried doing it in asp.net by using System.Web; using System.Web.Caching to enable the use of Cache. so now i m actually wondering whether this could be used in a windows form application. can a windows form application call to this cache...?
|
|
|
|
|
|
You could use the Web.Caching class to do what you want.
If your app isn't web based, you might also want to look at this MSDN .NET Caching Guide[^] for some other ideas.
RageInTheMachine9532
|
|
|
|
|
Yeah the application that i m doing isn't web based...
For web based, i implemented something like this...
// Global Declaration
private Cache m_Cache;
// Constructor
m_Cache = HttpRuntime.Cache;
// The implementation
if ( m_Cache["Sql"] == null )
{
/*
1. Get Data To Be Cached From Database Into A DataSet
2. Insert DataSet To HashTable
3. Insert HashTable to m_Cache
*/
}
else
{
/*
Get The Required HashTable From Cache
*/
}
But then for my Windows Forms Application ( Isn't Web Based ), i wanna do it something like how i did it with the HttpRuntime.Cache but then i can't coz i don't wanna use Web.Caching Class. I know that by using Hashtable is already a form of caching, but how do i initialize a Hashtable for a runtime cache? i mean something like this...
// Global Declaration
private Hashtable m_Hashtable;
// Constructor
m_Hashtable = HttpRuntime.Cache; // Which is impossible coz i m not using Web.Caching Class.
Pls Advice...
|
|
|
|
|
Hi,
I want to hide the scroll bar of Panel without giving autoscroll property "false". I scroll that Panel from the other button's event by using win32 api. If I set autoscroll property to "false", panel cannot scroll. I don't want to see the scrollbar in Panel, but I want scroll Panel. How do I do?
Regards,
|
|
|
|
|
I'd recommend not using autoscroll ability. Instead, handle scrolling yourself, use vertical and horizontal scrollbar controls.
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
Does anyone have any examples of using C# to communicate with a RS232 device much like the MSComm component that is included in VB6?
|
|
|
|
|
|
I need to know how to retrieve the path of an image that is a picture box for a program that I am building. Any points in the right direction would be greatly appreciated.
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
Since a PictureBox only displays an image passed to it through it's Image property, there is no way to ask the PictureBox where it came from. This would have to come from the Image object that is passed to the PictureBox. This could either be a Bitmap object or a Metafile object. In either case, neither exposes a property to see what the source file is. If your setting the Image property thru code, you should already have the filename stored in a variable when you created the Bitmap object to pass to PictureBox.
Now, I know what your thinking. You can set the Image property of a PictureBox in design mode. True, but the image is then stored in the executable as a resource when your project is compiled. The original filename isn't stored as part of the executable, but is stored in the project source files, inacessible to the running executable.
RageInTheMachine9532
|
|
|
|
|
the .NET app saves the image inf in resourse files,
I don't know how to retrieve the path but you can save the image in specified using
PictureBox.Image.Save(....
|
|
|
|
|
I need to create a activex or control to get web page snapshot and save it as an image (gif or jpeg).
I don't know if its possible with c#.
Could you please help me by sending any example or link?
Thanks a lot.
|
|
|
|
|
*Apology in Advance*
ALT+PRTSCRN ?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
..
I know that one but my problem is that I need only the content area and that too programatically. Something like this site is doing:
http://www.tonec.com/download5.html
but its doing so many things and I just need to create a snapshot of web page content area as jpeg file.
The project I have needs to add a button in IE toolbar and when clicked, create a snapshot of web page content area into image file jpeg/gif.
Any ideas??
|
|
|
|
|
Sorry, I just couldn't resist; personally, I'd pay the $75, since I'd spend about that much of my time trying to figure out a way to do what they've already done.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
So i think it would be handy if I could write a function that does this:
If \\server\share\binary.exe is managed code
Do this
Otherwise it is not managed code
Do that
Is such a thing possible?
Thanks,
Ian
|
|
|
|
|
I know this function works with managed and unmanaged dlls. You could try it with executables though:
public bool IsManaged(string filePath)
{
byte[] Data = new byte[4096];
FileInfo file = new FileInfo(filePath);
FileStream fin = file.OpenRead();
int read = fin.Read(Data,0,Data.Length);
fin.Close();
if ((Data[1] << 8 | Data[0]) != 0x5a4d)
return false;
Int32 iWinNTHdr = Data[63]<<24 | Data[62]<<16 | Data[61] << 8 | Data[60];
if ((Data[iWinNTHdr+3] << 24 | Data[iWinNTHdr+2] << 16
| Data[iWinNTHdr+1] << 8
| Data[iWinNTHdr]) != 0x00004550)
return false;
Int32 iLightningAddr = iWinNTHdr + 24 + 208;
Int32 iSum=0;
Int32 iTop = iLightningAddr + 8;
for (int i = iLightningAddr; i < iTop; i++)
iSum|=Data[i];
if (iSum == 0)
return false;
else
return true;
}
Got this from a blog entry here:
http://blogs.msdn.com/adam_nathan/archive/2003/10/26/56786.aspx[^]
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hello,
Is there a file properties dialog control in C# (similar to the OpenFile dialog)? Something similar to what you see when you check a files properties using Windows.
Right now I am using FileInfo and FileAttributes to get the necessary info but if there is a ready made dialog that would be great (though I can't seem to find one).
Thanx a lot,
-Flack
|
|
|
|
|
No, there is no FileProperties Dialog native to C# or the .NET Framework. The easiest solution is to build your own dialog.
RageInTheMachine9532
|
|
|
|
|
If you know the path to the existing file, you could P/Invoke SHObjectProperties :[DllImport("shell32.dll", CharSet=CharSet.Unicode)]
private static extern bool SHObjectProperties(
IntPtr handle,
[MarshalAs(UnmanagedType.U4)] SHOP type,
[MarshalAs(UnmanagedType.LPWStr)] string path,
[MarshalAs(UnmanagedType.LPWStr)] string initialPage);
[Flags]
private enum SHOP
{
PRINTERNAME = 1,
FILEPATH = 2,
VOLUMEGID = 4
}See http://msdn.microsoft.com[^] for more information about this API.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
I have a problem that is driving me mad. I have checked the weba and there is a number of results explaining the problem but no real solution. I am putting together a GUI. I have put a lot of work into it and just when I am finished I jump from code view to design view and BANG get the following message:
"an error occurred while loading the document. fix the error, and then try loading the document again"
I wasnt editing any of the control properties. This has happened already this week but as I didnt have that much work done on it I started again (gave me a chance to tidy up) but I would really like not to have to redo he work for the third time and then it happen again. Is there any fix for this? Is it and IDE problem? Any comments/suggestions would be brilliant,
Regards,
John
|
|
|
|
|
There's many problems that can cause this - such as editing the code in the "don't edit this code" region (the designer-generated stuff). I commonly have to do this to enable localization in our application without the overhead of localizing EVERYTHING that can be localized (makes the app bigger and much slower), but I don't really need the designer after initial layout.
If you're using the designer to support derived controls and forms, you have to make sure that everything you access is either public, protected, internal, or protected internal.
Either way - or anything else that may choke the designer - should show up as errors in your task list. These will commonly reference a file and a line number that you can jump to (just double-click it) and see exactly what the problem is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your reply. But none of the suggestions applies to what I was doing. I didnt edit the designer code. All I have added to the code is a few functions at the end to shut down the app etc. I have gone thru each control and its properties and the problem is with the Location & Size properties. On commenting these out I can view it in the form designer. Uncommenting one line gives me the duplicate error even though ALL other controls have had there Size & Location properties commented out. It compiles and runs perfectly. No errors. No warnings. Its just when I view the design view. I have spent a good number of hours putting together the complicated interface and if I have to start again I'll need to be committed!!! Any help please?!?
|
|
|
|
|
First, make sure the Point and Size are fully-qualified. The designer expects this.
Second, you've made your UI. Just because it won't show in the designer doesn't mean it won't display correctly. I'd say don't worry about the designer if you don't want to redo the interface (and that doesn't insure that this won't happen again) and just hand-code it. It isn't difficult, especially once you got the gist of everything laid out the way you want it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
thanks for that. I think that is the best route. Below is an example of the code:
this.pctBtnCOCViewOrders.Location = new System.Drawing.Point(8, 135);
this.pctBtnCOCViewOrders.Name = "pctBtnCOCViewOrders";
this.pctBtnCOCViewOrders.Size = new System.Drawing.Size(86, 22);
As I said, nothing has been changed in here. But when I run the code it builds and displays the UI fine so I will hand-code it. Thanks again.
|
|
|
|