|
Why not just do Convert.ToInt32("4")?
Andy
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
I am pulling the data from the server.
|
|
|
|
|
Try converting to a double or float, then cast it to an integer.
|
|
|
|
|
Don't use Convert.ToInt32 use Int32.TryParse() instead.
|
|
|
|
|
Hi,
In my winform, I have a blocked call to dll that takes a while to return.
I wanted to show to the user a progress bar like to indicate that some process is going on behind and they should wait until its finished.
So, I added an aminated gif image to indicate the progress. But the animation won't happen when the call is blocked and until it returns. This is because its on the same thread.
I know threading will solve my problem, but I dont want to put the blocking code inside another thread since it involves lot of UI updates. Is there any way to put the animated gif inside another thread and make it to animate while the dll code is executed, or alltogether different solution to make this thing work.
Thanks in advance.
|
|
|
|
|
No, there isn't. If you put the blocking call on the UI thread AT ALL, no UI updates will happen until that call returns. You're only choice is to put the long workload in it's own seperate thread and rewrite it so it doesn't do ANY UI updates. It can, however, be written to fire off events that the UI thread can subscribe to.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
how can i open gif files?
|
|
|
|
|
How can I (using a windows form application) upload and download MS Word documents into sql server? I have been able to do this without a problem in ASP.net pages, but I can't figure out how to do this using Winforms. Basically, I have been able to read a byte array containing the data into a memorystream object, but I can't figure out how to get the data from that stream object into the word document itself.
Can anyone provide any information or reference articles regarding this topic, please?
Thanks
|
|
|
|
|
What's the problem? Take your byte stream and save it to a file on disk, VOILA, you've got a Word document.
|
|
|
|
|
Thank alot for the response.
I was actually trying to insert this data into a document while in memory and then display it to the user. The primary thing that I'm really trying to avoid is having to worry about file and folder permissions issues which normally happen when trying to write directly to a user's machine. Is it possible to use this stream and somehow display the Save File As dialog so that the user can save the files themselves (while forcing them to save it as a .doc file)?
Thanks again.
|
|
|
|
|
It isn't possible to open a Word document from an in-memory stream, I'm reasonably certain. The problem is that all windows programs deal with files in the form of file paths; if you don't have a file path, you don't have a file.
The only remotely possible way I see is to write some Windows shell extension that makes your stream of bytes look like something available on the file system, giving it some path that isn't necessarily on disk, but still exists nonetheless. But that may be overkill for you.
I'd recommend just writing the file to the user's temporary directory. If you're executing a program, you can write to certain directories even if you're a limited user or running from a limited security context. For example, limited users can write data to this folder:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Or, if you're running in a limited security context, you should be able to use the System.IO.IsolatedStorage APIs to store data (however, launching a file on disk requires disk-access priviledges, which may not be granted to you if you're, say, running your app over the internet via ClickOnce).
|
|
|
|
|
Jonesjo wrote: Is it possible to use this stream and somehow display the Save File As dialog so that the user can save the files themselves (while forcing them to save it as a .doc file)?
Sure. Use a FileDialog , this will return a string with the path and filename the user wants to save the file to. You can then use a StreamWriter(path) to save the file.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you both, Judah and Greeg. I used a combination of both of your ideas (using the FileDialog/StreamWriter and streaming to a file on the user's disk which appears to work pretty well since the app will be able to run in the identity of the user). Everything looks like it's working great.
Thank you both. Your answers were really helpful.
|
|
|
|
|
By the way...Soloflexx = Jonesjo.
My browser logged me in automatically with the wrong profile.
Thanks again,
Jonesjo
|
|
|
|
|
actually i want to compare the date in database with date now...so, how can i do it? if somebody know, help me plz...
jema
|
|
|
|
|
|
I'm constantly receiving this "Old format or invalid type library" error when trying to work with an Excel.ApplicationClass object using System.Runtime.InteropServices. I made all the settings using DCOMCNFG and REGEDIT. I checked the regional language settings for my computer and for Office (they are both en-US now). What does LCID (locale identifier) exactly mean and where should I use it to get my app errors free?
wladutti_cellular_daemon
|
|
|
|
|
Hi guys, I have a program (in Visual studio 2005) that interacts with a webBrowser component, it needs to press buttons on webpages in that webBrowser, so far I have done this by focusing on the button then programmatically pressing "enter" as follows;
webBrowser1.Document.GetElementById("button1").Focus();
SendKeys.Send("{ENTER}");
This works, but is less than satisfactory, because if the user starts using a different application it fires the "enter" key in the other application. This can mostly be avoided by checking my application has the user focus, but then if it doesn't have the user focus the "enter" is never fired.
Is there a better way of programmatically pressing a button on the webpage?
thanks a lot
Martin
|
|
|
|
|
You could figure out what the button is doing from the Javascript and just call that javascript function directly. I guess the real question is, what are you really trying to do?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
I am making a program to help with editing Wikipedia (you know, the free encylopedia, see http://en.wikipedia.org/wiki/Main_Page). I can get and change the text in the textboxes, but I need to be able to press the "Save page" button when done. For an example of a webpage I am trying to press a button on see http://en.wikipedia.org/w/index.php?title=C_Sharp&action=edit
hope that explains it a bit more. thanks
|
|
|
|
|
Hello,
Can you show me a snippet to post form data from Windows form to a URL thru a webbrowser control so that the post result will be returned to that webbrowser.
Thanks
|
|
|
|
|
I don't have access to my code at the moment but I have successfully done this by navigating to the button's HtmlElement object in the document and then invoking the InvokeMember() method:
HtmlElement elt = webbrowser1.Document.GetElementsByTagName("INPUT")[0];
elt.InvokeMember("Click");
Now, that's rough approximation. You may have to make to changes to get it to compile. But you get the idea.
-- modified at 17:15 Wednesday 26th April, 2006
|
|
|
|
|
Hello everybody!
I'm trying to create a dynamic table to store data retreived from a prosthetic robot arm about its environment (im doing robotics research). Basically using a fuzzy logic AI i want the system to remember what it encounters, group similar objects and be able to ask question about new objects, or identify objects.
This is a multi-dimensional problem to say the least, each finger has an 8*8 array of tactile (touch) sensors, and an overall force exerted sensor. I haven't decided if im including some in the palm yet, just waiting to see how hard playing with fingers is
I am trying to remember the data encountered and the labels associated with them in the systems memory. I've made this currently using a multi-dimensional array with malloc statements and it works. Unfortunately it is hard to manipulate and does not travel between programs well, because of this I would like to create the same setup using container classes, or possibly the new and delete statements. Also because of the size of the system its hard to publish here.
After looking at the new and delete statements they do not have a realloc equivalent, this is essential because every time the system encounters a new label it must expand the array (or table etc.). And so I am back to container classes, or any other idea you throw at me, but I do not know how to use them.
Do you know an example of the kind of thing I am creating, or possibly a good book to start me off on? Even better, I'm sure that the actual syntax (for creating, resizing and removing a multidimensional memory system) cannot be more than a few lines, if it is this simple could you please write it down for me?
One other thing, it can't forget anything whilst resizing, and I must be able to manipulate each part individually...
Please shed some light on my project!
---------------------------------------------------------------
"Little creatures of nature, they don't know that they're ugly"
-- modified at 11:11 Thursday 9th February, 2006
|
|
|
|
|
There are several types of collections that you can use for handling lists of dynamic size, like ArrayList, HashTable, Queue, SortedList, ListDictionary, HybridDictionary, NameValueCollection, et.c. It all depends on how you want to access the data. If none of the list types meats your requirements, you can easily extend some of the list classes and add the functionality you need.
---
b { font-weight: normal; }
-- modified at 11:53 Thursday 9th February, 2006
|
|
|
|
|
Hi @ all,
after reading the sources of the Webcam project like Motiondetection und Webservice I think I understand how to get a picture from my Webcam. But how can I get the Live Video from my Webcam? Like the one you see in the Eindows Explorer by clikcing at your Webcam? I saw a Delphi Code where the LivePicture was associated with a Panel and so the LivePic was in the Panel. But how can I do that with C#? In all Projects here they use the camserver.dll but how can I do that with own code? Can anyone help me?
Thank you so much
twickl
|
|
|
|