|
OK... I have successfully written to registry, my application is assocciated with all xml files on the computer and by default my application opens when you double click on an xml file
However am still having the same problem. when you right click on an xml file and select the "Open With Menu" my application is listed with my application icon but my application name is blank...
How can I get the application name to display beside my application Icon On Open with menu?
could this be a setting on .Net?
Please Help........
|
|
|
|
|
Hi There,
I have a background worker thread on my Form.
In 'DoWork' A call is made from the thread to pump data out to Excel. The visible property of my Excel Application is set to false until 'RunWorkerCompleted' (there may be a lot of data and the users don't want to see it being churned out) when visible is set to true, I also use the .Activate method :
excelApplication.Visible = true;
((Microsoft.Office.Interop.Excel._Workbook)excelWorkbook).Activate();
Everything works fine except the Excel appears behind my form - not the front.. annoying .. in addition its only happening on my tester's machine (typical!) and not mine. It is the last code that executes.
excelApplication and
excelWorkbook are in a different class which I suspect is the root of the issue, also it needs to be inside the thread so the UI is not affected when the form is moved around and such like.
Any ideas?
Thanks very much
Jon
|
|
|
|
|
Hi there,
I don't see why you need the below call, just setting visibility to true works fine for me:
((Microsoft.Office.Interop.Excel._Workbook)excelWorkbook).Activate();
You are right that you should not have the application and workbook objects in different classes. I doubt that is causing the sheet to appear behind your form though.
Have you tried a simple send to back call on the form after you make the sheet visible?
Cheers,
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
|
|
|
|
|
Thanks Mark,
I will try the back call.
Sorry, was a rather vague there, my Application and Workbook objects are in the same class (Excel class) which is not in the Form class (obviously).
Thanks very much for the help,
Jon
|
|
|
|
|
|
Hi Everyone-
I have built a help-desk application that allows agents to create tickets with issues that our technicians are dispatched to resolve. Our company for the most part operates in three states. What I am looking to do, is have a section in the application that displays a map of our region, with the three states visible, with markers or pins on them.
The idea is a new call comes in with a problem in a city. The dispatcher can look at the map and see markers/pins of all of the technicians and where they currently are. The dispatcher can then make a determination "Steve is only 10 minutes away, lets send him after he is done with his current call".
I am wondering if anyone knows the best way to go about doing this for a C# Windows Forms application. I was tossing around the idea of having a browser window somehow interfacing with Google Maps to tell it the area I want to display along with the pin/marker information, but was wondering if any of you could point me in the right direction! I would really like to accomplish this without the need for a local web server if that is possible.
TIA!
|
|
|
|
|
If the PC is always online, the use WebBrowser control, open google maps, and put some coordinates in it. That is the easiest way.
|
|
|
|
|
That's exactly what I would like to do! I have been searching for a little while as to an easy way to open google with coordinates. Everything that I have found so far requires custom web pages with all of that jazz. Any suggestions as to easy way to add points/coords to google map from within a browser in C#?
|
|
|
|
|
|
Hi,
Can someone tell me a MODULO algorithm like google's, typical calculator's, excel's, etc?
Because, they all return 0 for:
4029800 mod 100
But C# (and java I think) return -10
|
|
|
|
|
4029800 % 100 gets 0 for me
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Quake2Player wrote:
But C# (and java I think) return -10
Could you show the code? That really isn't what should happen, not in Java either.
|
|
|
|
|
Your code is bad somewhere. For two positive integers, modulo is never negative.
|
|
|
|
|
Random r = new Random();
int key = r.Next(0, 10000);
int prime = r.Next(key, key * 999);
int a = r.Next(1, prime - 1);
int b = r.Next(0, prime - 1);
Console.WriteLine(key);
Console.WriteLine(prime);
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine( ((key*a + b)%prime) % 1000);
Console.ReadLine();
For example:
In google: (((8 568 * 4 974 445) + 2 820 002) % 7 661 773) % 1 000 = 563}
In c#: (((8 568 * 4 974 445) + 2 820 002) % 7 661 773) % 1 000 = -732
|
|
|
|
|
Quake2Player wrote: 8 568 * 4 974 445)
using 32-bit signed arithmetic (as in int) this results in an overflow, that is where the negative stuff is coming from. Nothing wrong with the modulo operator.
test: declare long variables, initialize them, and use those for your expression, instead of numeric constants. (decimal should work too).
|
|
|
|
|
Beat me to it!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
It's because of the overflow in the first part of the calculation. Make one of the values a double and you get the correct result.
(((8568 * 4974445d) + 2820002) % 7661773) % 1000)
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
How can I use long if I'm generating random numbers???
This is all about the UNIVERSAL HASHING FUNCTION:
<code>
public int Evaluate(int key)
{
do {
randomPrime = rnd.Next(10001, 10000*999);
}
while (!IsPrime(randomPrime));
this.randomA = rnd.Next(1, randomPrime - 1);
this.randomB = rnd.Next(0, randomPrime - 1);
return ((randomA * key + randomB) % randomPrime) % tableLength;
}
</code>
Notes:
-10000 is the maximum possible key
-tableLength is 1000.
-randomA, randomB and randomPrime are ints
As Im getting negative numbers Im trying
return Math.Abs(((randomA * key + randomB) % randomPrime) % tableLength);
But its not giving me fast results in the hash table
modified on Saturday, August 29, 2009 6:01 PM
|
|
|
|
|
Hello. I just want to know if its possible for me to store the data inside an array to a text file and also if its possible to transfer all the data in the text file into an array?
|
|
|
|
|
Yes - Its possible
|
|
|
|
|
Ok..Thanks..
|
|
|
|
|
As Coding says, yes it is possible. How you do it will depend on what kind of info you have in your array, and what you want to do with the text file.
If it is an array of strings, easy peasy.
If it is an array of something else, then slightly harder - you will either have to do the work yourself or use a Formatter - XML, Binary or Soap.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
oh..ok then..thanks for the info..
|
|
|
|
|
Sorry, that was a little unhelpfull!
For an array of strings, look at File.WriteAllLines[^]. To read it back, use ReadAllLines
For an array of something else, you will need to:
1) Open file
2) Set up a loop through each element of the array
3) For each element, use ToString member, or string.Format to create a string
4) Write the string to the file
5) Close the file.
To read them back, use the Parse method after reading the line.
or look at BinaryFormatter, XMLFormatter and SoapFormatter in the MSDN, but these will not necessarily create a file you want to look at, or edit by hand!
Good luck!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|