|
I consider SledgeHammer's response, using a Lambda, as the best, elegant solution (and I'm not competent in WPF/XAML), but I am curious, if you are defining a custom EventArgs class for use with your EventHandler:
Why could you not add another parameter, of whatever 'mv's Type is, to that custom EventArgs class; then in your explicit EventHandler implementation which is "wired-up" to the Event, you can test if that instance of 'mv is null, and ignore, or, if not null: do whatever you want to do ?
If this question is (and I fear it may be) way out-of-focus, I appreciate being corrected !
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|
|
This is actually a standard event argument for "the technology formerly known as Metro" style apps raised by the subsystem. It's not a custom one the user has created.
|
|
|
|
|
Yeah, the lamba solution I provided was a "quick fix". I wouldn't do it that way in "professional" code. Making it a member was cleaner as noted. Unfortunately, I think OP is going down the entirely wrong path creating objects in code, but when you post those kind of responses on CodeProject, you tend to get 1 voted by people who "don't like your attitude", so I stopped bothering .
There is a danger with the lamba solution, that you could be passing an unintended instance of the wrong object if you don't pay attention .
|
|
|
|
|
Hi
I have an array and i want to put the ّFloat Variable
into the array.
|
|
|
|
|
What kind of array do you have?
You can convert the float to another type for e.g. int by using Convert.ToInt() method[^].
If you need to convert the entire array to another type, use the ConvertAll<> method[^].
|
|
|
|
|
There is no problem in convert.
I want to put each digit of float in each index of float array.
|
|
|
|
|
Are you wondering how to assign a variable to an array?
If your array is a Float type then it's rather straight forward, see below.
float[] Variable = new float[ ];
Variable[0] =
Basically, the Variable[0] is the new variable array with the index (place of the array that you want to write on) which always begins at 0. So, in this case the first index of the array is 0, the second index is 1 and so on and so fourth.
If you need to put a variable that isn't of the float type then you can convert it into that type using the command below.
Convert.toInt32();
Hope this has been of some help and I didn't make it seem over complicated! :P
Best of luck learning c#.
|
|
|
|
|
To "echo" the question raised by AbhinavS's comment: unless we know what type of array (array[float], array[int], array[double], array[?]) you have to begin with, and why you want to stick a float in it if the Array is not of Type 'float: we really can't answer this question.
You might want to read about (from MSDN documentation) the 'Float type:[^]. And, may I also suggest you click on the links at the bottom of this page that lead to content on Implicit and Explicit conversion of numeric Types.
In any case I suggest you think about using a Generic List, rather than an Array.
Here's something else for you to think about:
using System.Collections.Generic;
public List<double> doubleList = new List<double> {1, 2.0, 3.3333, 100038};
public List<float> floatList = new List<float> {1, 2.0, 3.3333}; best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|
|
Dear Friends,
I have a desktop application and i want to save path in database and generate it in specific location
Thanks
Mena Alfons
Junior .Net Developer
|
|
|
|
|
|
I have a folder o my web host called
http://www.domain.com/resume
and there I have many resumes stored.
I want to know how can I view it using WinForm application?
|
|
|
|
|
Your question is rather unclear; do you want to use the "web host" as if it were a local readable/writeable folder? Can you describe a typical use-case?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
i have a portal where people upload their resumes to the company from ASP.NET website. Files will be save on remote host where the website is hosted.
In the company, HR will use WinForm to view the CVs
that's what I want...
|
|
|
|
|
Have them download the resumes and open them with the default application that's bound to the Word-document filetype?
Will they use your WinForm? OpenOffice? Do they know how to download a file, or will you provide a mirror at the location? A simple app that downloads the file and puts it in a local folder should suffice then, shouldn't it?
A use-case is a description of what the user would do with the file; double-click a link in the browser from your website. Fine, FireFox downloads it, they open it with OpenOffice. Again, explain the problem.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The application is pior WinForm
what I want is the word document to be displayed on the form itself without a help of a third party and without downloading it to the local disk similar to what I do when displaying an image from remote server on a picture viewer.
|
|
|
|
|
jrahma wrote: what I want is the word document to be displayed on the form itself without a help of a third party and without downloading it to the local disk similar to what I do when displaying an image from remote server on a picture viewer.
..that's the kind of things you usually include in the first post.
How would you decode the older binary format, without the help of a third party?
I suggest you download the free Word-viewer on the PC of your clients. There's an article here somewhere on CodeProject that shows how to change the parent of a random executable to your form; that way it looks as if the executable is a control, embedded in your form. Use it to get that free reader on your form, and display anything Microsoft Word can handle.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
hi can you use Below Code
using System.Runtime.InteropServices;
using Word = Microsoft.Office.Interop.Word;
public Word.Document document;
public static Word.ApplicationClass wd = null;
private static string filename = null;
filename = t_filename;
wd = new Word.ApplicationClass();
document = wd.Documents.Add(ref fileName, ref newTemplate, ref docType, ref isVisible);
wd.Visible = true;
wd.Activate();
|
|
|
|
|
Hi
I need to implement a "real time" logger. The idea is to get the last line logged even if the application hangs one instruction after.
Because the logger takes the data from GUI I need also not to overload the GUI thread. The data comes fast in the GUI, so I will implement a LoggerQueue.
I have been thinking of creating a new process for the logging and send my information with some basic IPC.
the question:
Is it possible to create a real time process?
I mean not by creating a separate project and a separate exe file.
Is it possible to lunch some code in a separate process at run-time?
|
|
|
|
|
George Nistor wrote: Is it possible to create a real time process?
Yes.... if you are using a real time OS.
George Nistor wrote: I mean not by creating a separate project and a separate exe file.
I do not know of any other way to do it.
George Nistor wrote: Is it possible to lunch some code in a separate process at run-time?
I am not sure what this means.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
George Nistor wrote: Is it possible to create a real time process?
What do you consider to be a real-time proces? Windows isn't a realtime OS, so the simple answer would be "no".
George Nistor wrote: Is it possible to lunch some code in a separate process at run-time?
Yes, using Process.Start .
George Nistor wrote: I need to implement a "real time" logger. The idea is to get the last line logged even if the application hangs one instruction after.
Let's rephrase that to "log as much as possible". What you'd want to build is called a watchdog-application. What you'd want to log is called a minidump. There's an awesome introduction here[^].
Another alternative would be using OutputDebugString ; that would come closer to the idea of "logging actions", and can be read remotely.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
You could, but you'll be writing about 10 times more code than just writing a seperate .EXE project and launching it from your existing code.
But, if you must, check out the System.CodeDom[^] namespace.
|
|
|
|
|
You mean like starting the same process again.
I have to see if it not alreadz running I will start it in "master" mode, if it is running in "slave" mode.
slave mode is the logger.
ps. what I wanted was just not to have a separate exe and still start it like a real PROCESS.
|
|
|
|
|
Ah. No, Windows does not support creating a seperate process from an in-memory byte stream in a process. You could keep the .EXE image in your app's resources, but you'd have to write it to a .EXE file on disk before you could launch it.
|
|
|
|
|
I have a problem with declaring a connection string in class file in C# and accessing that connection string in .cs file . i don't know how to do that .i am new to this thing. i am using visual studio 2008 and sqlserver 2005
|
|
|
|
|
Why are you asking this again? Besides that your question does not make sense. You are having trouble declaring a string in a .cs file and having trouble access that string in a .cs file?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|