|
if you mean to reset the controls to its a default value for a property i.e Text you may follow this step
1. create list to buffer a property value for each controls in your form
2. get property value back to controls according its index
sample
private ArrayList initialValues = new ArrayList();
private void StoreInitialValue()
{
foreach (Control ctl in YourForm.Controls)
{
initialValues.Add(ctl.property);
}
private void ResetToInitialValue()
{
for (int i=0; i< YourForm.Controls.Count; i++)
{
YourForm.Controls[i].Property = (typeof(your.stored.property.type))initialValues[i];
}
}
}
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
thanks dhaim! I am going to give the code example a shot
|
|
|
|
|
Hi,
Does anyone know a free (or not too expensive) C# lib for fingerprint reading and comparation?
Thanks,
Dirso.
|
|
|
|
|
You might want to take a look at Windows Image Acquisition Library (WIA). I've only used it for document scans but it may have what you need for fingerprints.
If you're working with specific hardware, then you may want to check and see if the vendor has a C# library for their products.
|
|
|
|
|
I was looking to add in some simple word processing ability into my application. I need spell check and a few other simple things Microsoft Word does.
Does anyone know of a control / article that could offer any assistance here?
The less word automation needed, the better.
|
|
|
|
|
In .NET 3.+ WPF, spell-checking is built into either the textbox, richtextbox, or both. As for other capabilities their are a few articles on this site that can assist you. Do a quick search.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
check out visual studio office tools:
www.microsoft.com/downloads/details.aspx?FamilyId=5E86CAB3-6FD6-4955-B979-E1676DB6B3CB&displaylang=en
You got a version for VS2005 (.Net 2.0)
and a version for VS2008 (.Net 3.5)
Using these tools you can write add-ins to word and/or use word's controls.
besides that, if you like you can automate/control word application itself using office interop (just google it). meanning, you can automate real instance of word to do things for you...
|
|
|
|
|
Hi Guys
I want to convert the pdf file to txt file. I'm using this code
private static string parseUsingPDFBox(string input)
{
PDDocument doc = PDDocument.load(input);
PDFTextStripper stripper = new PDFTextStripper();
return stripper.getText(doc);
}
but it throw this exceptions
IOException was unhandled
Error: Header is corrupt ''
Please Help
|
|
|
|
|
|
Hi all,
I need to call a business logic class via web servicing without using reflection. I pass the class name and method as string parameters in the web service. But it doesn't work the conversion from string to an object.
If I pass the object class then it works but I don't want to do that as the webservice must run independently
The code I use is,
[WebMethod]
public object ExecuteMethod(string ClassName, string MethodName, params object[] arguments)
{
object obj = null;
Type type = Type.GetType(ClassName);
try
{
obj = type.InvokeMember(MethodName, BindingFlags.Default |
BindingFlags.InvokeMethod, null, null, arguments);
}
catch
{
throw;
}
return obj;
}
Thanks in advance
|
|
|
|
|
ClassName need to be a fully qualified type name.
BTW: what you are doing is reflection
|
|
|
|
|
Could you provide me with the code without using reflection
Thanks
|
|
|
|
|
Hey, guys.
In searching for a solution to my problem below (http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2645163[^]) about stopping the MS dialog boxes in the WebBrowser control, I've discovered that the IWebBrowser2 interface has a property called Silent that seems to fit the bill. WebBrowser doesn't seem to implement IWebBrowser2 out of the box and embarrassingly, my COM background is in C++ rather than C# so I find myself fumbling a bit.
I'm hoping it's only minor rocket science to derive a new WebBrowser control & implement this interface so that I can get to the Silent property. All I'm using the browser control for is to navigate to a site & then save off an image capture of it to a jpeg. Everything is working fine, but I'm getting hammered by MS messages boxes complaining of scripting errors, unknown publishers, etc. (and I've tried all the browser control properties and IE options to no avail). I'm hoping Silent works as advertised.
Apologies for such a newbie question, but a little guidance in this area from the more experienced hands would be most appreciated. What's the quickest path to getting IWebBrowser2 implemented on the WebBrowser control?
Thanks!
|
|
|
|
|
|
Hey, man.
Thanks for the link, I appreciate it. I actually downloaded and looked at that around 4 AM this morning. He'd done a really nice job on his control, but for both the problem I'm trying to solve and as a simple tutorial on implementing IWebBrowser2, it's major overkill for my needs. He's implementing the interface, but it's buried in with a ton of other stuff and I just don't have the time to dig for it.
I was hoping to find a quicker, simpler, more to the point article entitled, "How to implement IWebBrowser2 when you're just too plain stupid to use COM in C#, in three easy steps." Or something of that sort. One can dream.
I do normally enjoy going through a good book or article, especially of this quality, but it's crunch time on this project (i.e. code till you fall asleep at the keyboard, wake up, code some more) and I'm currently just trying to put out the fire at my feet as quickly as possible. You know how it goes...
|
|
|
|
|
Christopher Duncan wrote: Got a winforms / c# app that uses the webbrowser control to navigate to and then save off a screen capture of the given web site. Unfortunately, trying to run this in a batch
Dude, don't use WebBrowser to scrape a screen. Use networking stuff to get the HTML directly!
led mike
|
|
|
|
|
Actually, I'm doing a fair amount of that in a different portion of the system, but that's a different critter.
What I'm talking about here is saving a screenshot of the web site's home page, which means something needs to read the HTML, handle all 90 gazillion variations of language versions and malformed tags, and then ultimately render that HTML as a graphical image. That's pretty much the short definition of a browser, which is why I'm useing the WebBrowser control to save off the jpeg of the home page screen shot.
Man, if there's a better way to get that jpeg that doesn't require me to deal with browsers, scripting errors, malware, IE popups telling you that they've done something about said malware, etc. then I'm absolutely all for it. Is there something easy and obvious that I'm missing here?
|
|
|
|
|
I am porting a VB6 winsock.ocx based library to a .Net Sockets implementation, and I am not the most savvy sockets programmer. The architecture of the communication system was designed long before I got here; so changing the overall design is not an option. Moreover, this system has a low frequency of tcp traffic, so the Socket.Connected will almost always be out-of-date.
The fundamental issue is the connected property of the socket. It does not seem to be funcitonal; however, I have found others that have had similar issues http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.connected.aspx[^]
When I stepping-through the code in the debugger, unplug the network at the right moment, and view the sock object with the quick watcher, it shows me the value of sock.Connected has changed to false as expected. However, while running the code below, in debug mode but not stepping-through, the behavior of sock.Connected is different (when I unplug the wire, it does not update to false).
Thoughts?
private bool isConnected(){
bool rVal = false;
try
{
bool blcking = sock.Blocking;
try
{
byte[] junk = new byte[2];
sock.Blocking = false;
sock.Send(junk, 1, 0, SocketFlags.None);
rVal = sock.Connected;
}
finally
{
sock.Blocking = blcking;
}
}
catch (SocketException e)
{
rVal = e.SocketErrorCode == SocketError.WouldBlock;
}
return rVal;
}
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Jason McBurney wrote: Thoughts?
My thought is, I hope you are hung up on the concept of interrogating the socket for it's state because that's what you saw in the VG6 *gulp* uh, mess. I hope you appreciate how difficult it is for me to even type VV6, see I just can't do it.
Using exception handling you can can just execute your code and catch exceptions indicating the socket is not connected. You should search around the internet, Sockets.com has been around for ever. Look for examples like the one in the documentation for Socket.Send[^]
led mike
|
|
|
|
|
led mike wrote: VG6, VV6
LMFAO!
Dave
|
|
|
|
|
I don´t know if you got the anser to your question, if not try to download some chat applications here in codeproject.
I started to built one but i didn´t finished it yet, and i didn´t find the code to acomplish all the things i have in my mind.
I´am not an advanced programmer but, i see in your post some similar code to the one i typed (and read before).
Good Luck
|
|
|
|
|
hi
i want to access to the root word storage object, i think i must use "stgopenstorage " win API
i need the code and i want to learn how to use it to access to root word objec,using c# 2003
and the all structured storage API can u give me a good site
thanx
|
|
|
|
|
Is there some reason you don't or can't use the Primary Interop Assembly?
led mike
|
|
|
|
|
which PIA i must use?????????
thanx
|
|
|
|
|
I don't have the requirements for your project, you do. Read the documentation and match it up against your requirements.
led mike
|
|
|
|